Skip to content
Kill the process running on a given TCP port on Windows, Linux and Mac.
TypeScript JavaScript
Branch: master
Clone or download
milewski Merge pull request #49 from milewski/dependabot/npm_and_yarn/mixin-de…
…ep-1.3.2

build(deps): bump mixin-deep from 1.3.1 to 1.3.2
Latest commit ff53589 Aug 28, 2019

README.md

cross-port-killer

Build Status npm version npm downloads dependencies Commitizen friendly semantic-release greenkeeper styled with prettier

Kill the process running on a given TCP port on Windows, Linux and Mac

Install

$ npm install cross-port-killer -D

Usage

import { kill, killer } from 'cross-port-killer';

kill(9090).then(pids => {
  console.log(pids)
})

// you could also kill pids manually if you know them... this would save you bringing up another lib, you are welcome.

killer.killByPid(12345).then(() => console.log('done'))
killer.killByPids([12345, 54321]).then(() => console.log('done'))

This lib also comes with a CLI.

$ npm install cross-port-killer -g
$ kill-port 9090

Dependencies

On Linux/Mac this library depends on lsof in case you don't have it installed (perhaps you are using docker?) run:

$ apt-get install lsof

On Mac, It comes with the OS by default so nothing to worries.

License

MIT © Rafael Milewski

You can’t perform that action at this time.