nodemon: nodemon is leaving one node instance running when it exits?

Hi Remy,

I launch nodemon like this:

Mac:webserv tito$ nodemon app.js 
15 Jun 13:05:08 - [nodemon] v0.7.8
15 Jun 13:05:08 - [nodemon] to restart at any time, enter `rs`
15 Jun 13:05:08 - [nodemon] watching: /Users/tito/Desktop/Tests/webserv
15 Jun 13:05:08 - [nodemon] starting `node app.js`
Express server listening on port 8080 in development mode

I can see two instances of node showing up in Activity Monitor (Mac OS X). If I terminate nodemon via Control-C, one instance is left behind. When I fire nodemon again I get the following:

Mac:webserv tito$ nodemon app.js 
15 Jun 13:07:10 - [nodemon] v0.7.8
15 Jun 13:07:10 - [nodemon] to restart at any time, enter `rs`
15 Jun 13:07:10 - [nodemon] watching: /Users/tito/Desktop/Tests/webserv
15 Jun 13:07:10 - [nodemon] starting `node app.js`
Caught exception: Error: listen EADDRINUSE

Is this expected? Is there anything I can do to make sure nodemon kills the two processes it created when it launched?

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Reactions: 3
  • Comments: 28 (9 by maintainers)

Most upvoted comments

Here’s my workaround:

Setup

npm uninstall -g nodemon
npm install -g pm2

Workflow

pm2 start --watch . --name=my-process index.js
pm2 logs my-process

Works great. Problem solved.

how do you kill nodemon when it wont shut off?

Also command below works fine;

pm2 start npm --watch --name=myapp -- start pm2 logs myapp

the same issue here 🙁

@angularturk that’s a completely different module and doesn’t provide any utility to this thread.

@andyfleming thanks! that’s nice option (y)

Same here. When I Ctrl+C or get an error on node, it leaves a process running when it’s stopped on console. So I have to kill it manually every time.

Same here on Linux Ubuntu 16.04 in (cluster mode) when i do Ctrl-C