pid-terminator
Version:
preventing eaddrinuse error
44 lines (30 loc) • 928 B
Markdown
# pid-terminator
Every so often, I get the following error: `Error: listen EADDRINUSE 127.0.0.1:3000`.
This module allows to terminate a process(pid) associated with a localhost/port that
is still running in the background even though the application was closed.For now, Mac only.
## installation
#### global
```bash
npm install pid-terminator -g
```
#### local
```bash
npm install pid-terminator --save-dev
```
## usage
you can terminate one or more processes:
```bash
$ pid-terminator PORT_Nº [PORT_Nº[...]]
```
you can also call it from a `npm script` in you `package.json`. Before
running the node application, `pid-terminator` will verify if a process
associated with `localhost:4000` is already running and terminate it if it does.
```json
{
"name": "my-project",
"version": "1.0.0",
"scripts": {
"start": "./node_modules/pid-terminator/build/bin/index.js 4000 && node server.js"
}
}
```