eaddrinuse
v1.1.0
Published
Kill whatever is squatting on your dev port. Zero dependencies.
Maintainers
Readme
eaddrinuse
Error: listen EADDRINUSE: address already in use :::3000A phantom process from a project you abandoned in March is still holding the socket. It has no window. It has no tab. It has only the port.
npx eaddrinusePort's yours again.
Install
Nothing to install. Run it:
npx eaddrinuseOr keep it around:
npm i -g eaddrinuseUsage
eaddrinuse # kill whatever holds 3000
eaddrinuse 5173 # kill that port instead
eaddrinuse 3000 8080 # kill several
eaddrinuse --list # show the squatters, kill nothing
eaddrinuse --all # sweep 3000, 3001, 4200, 5000, 5173, 8000, 8080Options
| Flag | What it does |
| --- | --- |
| -l, --list | Report only. Kills nothing. |
| -a, --all | Check the usual dev ports. |
| -f, --force | Skip SIGTERM, go straight to SIGKILL. |
| -q, --quiet | Print only failures. Good for scripts. |
| -v, --version | Print version. |
| -h, --help | Usage. |
Exit code is 0 when everything cleared and 1 when something survived, so it composes:
eaddrinuse -q && npm run devHow it behaves
SIGTERM first, so the process gets a chance to clean up its own sockets and temp files. If it's still alive 220ms later, SIGKILL. Pass --force to skip straight to the second step.
On Windows it uses taskkill /T to take the process tree, because your dev server is usually a child of something else.
Ports match exactly. Asking for 3000 will not touch 30001.
It refuses to signal PID 0, PID 1, or itself.
Platform support
| Platform | Lookup | Kill |
| --- | --- | --- |
| macOS | lsof | SIGTERM then SIGKILL |
| Linux | lsof, falls back to ss, then fuser | SIGTERM then SIGKILL |
| Windows | netstat -ano | taskkill /PID /T |
Requires Node 14 or newer.
Dependencies
None. Zero. The whole thing is one file and the Node standard library.
Every package you install to solve a ten second problem is a package you now have to trust forever. This one reads netstat and calls process.kill. You can read all of it in a few minutes, and you should.
Colors
Respects NO_COLOR. Also goes plain when stdout is not a TTY, so piped output stays clean.
License
MIT
