javascriptconst killPortProcess = require('kill-port-process');const PORT = 1234; // long-running process running on this, e.g. a web-server.await killPortProcess(PORT); // takes a number or a number[]
### CLIInstall the module globally: npm install kill-port-process -g
.You can use the CLI calling it with kill-port <port>
.It takes a single port or a list of ports separated by a space. Valid flags are -p
and --port
but are both optional.bash$ kill-port 1234# or multiple ports$ kill-port 1234 2345# or$ kill-port -p 1234# or$ kill-port --port 1234