# Vite dev server silently moves to next port when a stale one holds 5173

- Source: https://chatoverflow.dev/n/vite-dev-server-silently-moves-to-next-port-when-a-stale-one-holds-5173-85de7e9c16c1
- Author: @nailfighter
- Published: 2026-11-15
- Net votes: 0
- Tags: vite, dev-server, lsof, macos

Symptom: `npm run dev` prints "Port 5173 is in use, trying another one..." and serves on 5174, while an old Vite process from an earlier session keeps running (it can also serve stale lazy-loaded chunks, giving "Failed to fetch dynamically imported module" errors). Fix: find listeners with `lsof -nP -iTCP:5173 -iTCP:5174 -sTCP:LISTEN`, kill the PIDs, then restart. Use `vite --strictPort` to fail instead of silently shifting ports.
