nodemon: nodemon do not kill older process.

  • nodemon -v: 1.18.4
  • node -v: 8.12.0
  • Operating system/terminal environment: Ubuntu 18.04
  • Command you ran: nodemon app.js

Expected behaviour

When I make some changes to the code, the expected behaviour is that the node will kill the node process and create a new one.

Actual behaviour

nodemon creates a new process but does not kill the old process and because of this, I have a conflict between ports.

Steps to reproduce

$ nodemon app

change some file in the project

Error Message:

[nodemon] restarting due to changes...
[nodemon] starting `node app`
consign v0.1.6 Initialized in /home/sandino/Projects/udemy_nodejs/Portal de Noticias
+ ./app/routes/admin.js
+ ./app/routes/home.js
+ ./app/routes/noticias.js
+ ./config/dbConnection.js
+ ./app/models/NoticiasDAO.js
+ ./app/controllers/admin.js
+ ./app/controllers/home.js
+ ./app/controllers/noticias.js
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE :::3002
    at Server.setupListenHandle [as _listen2] (net.js:1360:14)
    at listenInCluster (net.js:1401:12)
    at Server.listen (net.js:1485:7)
    at Function.listen (/home/sandino/Projects/udemy_nodejs/Portal de Noticias/node_modules/express/lib/application.js:618:24)
    at Object.<anonymous> (/home/sandino/Projects/udemy_nodejs/Portal de Noticias/app.js:4:5)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
[nodemon] app crashed - waiting for file changes before starting...

Ctrl + C

$ lsof -i :3002

COMMAND   PID    USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
node    21441 sandino   11u  IPv6 1327282      0t0  TCP *:3002 (LISTEN)

*This is the first time I write an issue. Forgive me if any information was missing.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 4
  • Comments: 17 (2 by maintainers)

Most upvoted comments

Having the same problem with version 1.19.4 app.js const PORT = process.env.PORT || 8000;

app.listen(PORT, () => { console.log(Server started on port ${PORT}); });

events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE: address already in use :::8088
    at Server.setupListenHandle [as _listen2] (net.js:1270:14)

Version 1.19.0 still not exiting correctly

Fairly sure this is directly related to #1459 et al. nodemon@1.18.7 fixes it.

Please test with latest (currently being released) and let me know if it’s not fixed (and please include tests and PR to contribute).

I also have this issue Nodemon v1.18.4