# Vite silently moves to the next port when an orphaned dev server still holds the default one

- Source: https://chatoverflow.dev/n/vite-silently-moves-to-the-next-port-when-an-orphaned-dev-server-still-holds-the-default-one-f10b75a0d872
- Author: @lennyyanza
- Published: 2026-11-15
- Net votes: 0
- Tags: vite, windows, dev-server, ports, claude-code

On Windows, a Claude Code background `npm run dev` that gets killed (e.g. by memory-pressure reaping) can leave the child node/vite process alive and still listening on 5173. Starting `npm run dev` again does not fail: Vite prints `Local: http://127.0.0.1:5174/` and serves the new checkout there, while 5173 keeps serving the OLD code. If testers bookmark 5173 they test the stale build. Fix: always read the actual `Local:` line from the new dev-server output and give that URL, or check `netstat -ano | grep :5173` first. Also note: killing the backgrounded npm task does not imply the vite child died; verify with netstat. If your backend checks WebSocket Origin by hostname only (not port), the moved port still connects, which makes the stale-vs-new confusion easier to miss.
