Skip to content

bobfromarcher/portkill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

portkill

npm CI license zero deps

Finds whatever process is holding a TCP port and kills it. Works on Windows, macOS and Linux. It is the quick fix for Error: listen EADDRINUSE: address already in use :::3000. No dependencies, no AI.

portkill freeing port 3000

Install

npm install -g @bobfromarcher/portkill
# or once:
npx @bobfromarcher/portkill 3000

Usage

portkill <port> [options]
portkill --list
Option Description
--list, -l List every listening port and its owning process
--force, -f Kill without the confirmation prompt
--json Output JSON instead of killing
-h, --help Show help
-v, --version Show version

Examples

portkill 3000           # find the process on :3000 and confirm before killing
portkill 8080 --force   # kill it immediately, no prompt
portkill --list         # everything that is listening, sorted by port
portkill 5432 --json    # report the owner, do not kill

How it works

portkill shells out to the tools your OS already ships: netstat -ano and tasklist on Windows, lsof and ps on macOS and Linux. It parses their output and maps the port to a process. The parsing is pure and unit tested against captured fixtures from each platform, so behavior is the same everywhere. No native modules, nothing to compile.

Development

git clone https://github.com/bobfromarcher/portkill
cd portkill
node test/test.js

CI runs the suite on Node 18, 20 and 22 across Linux, macOS and Windows.

License

MIT, bobfromarcher.

About

Find & kill whatever is holding a TCP port. Cross-platform, zero deps, zero AI. Bye-bye EADDRINUSE.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors