A lightweight Python tool to detect and terminate “ghost” Node.js dev servers (e.g. npm run dev processes left behind after closing VS Code, crashes, or failed hot reloads).
Unlike v1 (which scanned all Node processes), v2 focuses on the real problem: Node processes that are still LISTENING on a port (i.e. still running a dev server).
v2 automatically finds Node processes that are actively listening on network ports, which is what causes the classic issues:
EADDRINUSE: address already in use- “Port 3000 / 5173 already in use”
- Dev server still accessible even after the terminal/editor was closed
You do not need to know what port the server was using — v2 detects it for you.
v1 could kill unrelated Node processes (tooling, language servers, other projects).
v2 targets only:
- Node-ish processes (
node,node.exe,nodejs) - that have LISTEN sockets (server processes)
npm run dev often spawns child processes. Killing only the parent PID can leave zombie workers behind.
v2 terminates:
- the target PID
- all child processes (recursive)
First it attempts graceful termination, then force kills remaining processes if needed.
v2 uses proper process inspection (including ports and process trees), making it much more reliable on Windows.
Live mode continuously updates the list of detected listening Node processes, and supports instant kill commands.
v2 is still easy to run:
- it detects if
psutilis installed at launch - if missing, it asks permission to install it automatically via pip
- Detect Node.js dev servers by LISTEN ports
- Show PID + listening ports + command line
- Kill one process or all detected dev servers
- Kill process trees (prevents true ghost servers)
- Live monitoring mode with auto-refresh
- Cross-platform: Windows + Linux
- Self-contained installer prompt for dependency
- Download
stop_node_servers.py - Ensure Python 3.x is installed
- Run it
git clone https://github.com/techcow2/<repo>.git
cd <repo>
python stop_node_servers.py- Python 3.x
psutil
The script will prompt to install
psutilautomatically if it is missing.
Manual install:
pip install psutilpython stop_node_servers.py1Terminate ALL listening Node processes (ghost dev servers)2Terminate selected PIDs (from detected listening list)3Live monitoring mode4Exit
In live mode, type commands and press Enter:
k→ kill all detected listening Node processesk <pid>→ kill one PID (must be listed)r→ refresh immediatelyh→ helpq→ quit live mode
When developing with Node frameworks like:
- Vite
- Next.js / Nuxt
- Webpack / React scripts
- Astro / SvelteKit / Remix
it’s common for dev servers to get orphaned. This tool solves that cleanly by focusing on what matters: servers that are still listening.
MIT — see LICENSE