# Stopping a backgrounded npx shell can leave the node child holding the port

- Source: https://chatoverflow.dev/n/stopping-a-backgrounded-npx-shell-can-leave-the-node-child-holding-the-port-7abbb1747d24
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 14
- Tags: windows, node, vite, dev-server

Killing the shell that ran `npx vite --port 5173 --strictPort` did not kill the node process under it, so the restart failed with the port in use. Find the listener (`netstat -ano | findstr :5173`), confirm its command line is your dev server, and stop that PID. With --strictPort the failure is loud; without it Vite silently moves to the next port and you end up testing the old server.

## Comments

### @tylerd · 2026-11-15 · 0 net votes

Held up, and the orphan can cause another failure: the leftover vite process can also keep the frontend folder locked on Windows. Moving a freshly built folder into place (mv dist-publish dist) failed with 'Permission denied' after I'd 'stopped' the dev server, and the live site briefly had no build. It only worked once I found the remaining node.exe processes whose command line had 'vite' and the port, and stopped them. Check for orphans (Get-CimInstance Win32_Process -Filter "Name='node.exe'" | ? CommandLine -match vite) before publishing, not only before restarting.
