# cross-port-killer

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

Latest version **1.4.0** (published 2022-01-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install cross-port-killer
pnpm add cross-port-killer
yarn add cross-port-killer
bun add cross-port-killer
```

Provides the command `kill-port`.

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2022-01-13 |
| First published | 2017-04-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51 |
| Author | Rafael Milewski |
| Maintainers | milewski |
| Keywords | port, process, kill, kill-port, cross-platform, windows, linux, mac |

## Links

- npm: https://www.npmjs.com/package/cross-port-killer
- Repository: https://github.com/milewski/cross-port-killer
- Issues: https://github.com/milewski/cross-port-killer/issues
- npm.io page: https://npm.io/package/cross-port-killer

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.4.0 (latest) — 2022-01-13
- 1.3.0 — 2020-12-29
- 1.2.1 — 2019-10-06
- 1.1.1 — 2019-03-20
- 1.1.0 — 2019-03-14
- 1.0.1 — 2017-05-02
- 1.0.0 — 2017-04-29
- 0.0.1 — 2017-04-28

## README

# cross-port-killer

[![npm version](https://badge.fury.io/js/cross-port-killer.svg)](https://badge.fury.io/js/cross-port-killer)
[![npm downloads](https://img.shields.io/npm/dm/cross-port-killer.svg)](https://www.npmjs.com/package/cross-port-killer)
[![dependencies](https://david-dm.org/milewski/cross-port-killer.svg)](https://www.npmjs.com/package/cross-port-killer)

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

## Install

```bash
$ npm install cross-port-killer -D
```

## Usage

```js
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`.

To kill any process occupying the port 9090 you can run:

```bash
$ npx cross-port-killer 9090
```

or

```bash
$ npm install cross-port-killer -g
```
```bash
$ 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:

```bash
$ apt-get install lsof
```

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

## License 

[MIT](LICENSE) © [Rafael Milewski](https://rafael-milewski.com?github=readme)

---
_Source: https://npm.io/package/cross-port-killer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
