nodemon -v: 1.18.4node -v: 8.12.0When I make some changes to the code, the expected behaviour is that the node will kill the node process and create a new one.
nodemon creates a new process but does not kill the old process and because of this, I have a conflict between ports.
$ 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.
Saldy, same for me.
nodemon 1.18.4
node 10.12.0
EDIT:
A few more infos:
In general, it doesn't happen on every change within my dist folder. The issue did not appear once on node version 10.11.0 which I updated to today.
Rolled back to LTS version 8.12.0 (which was on my roadmap anyway) and the issue seems to be gone.
So maybe it's just a version 10.12.0 thingy
Also happening here:
nodemon 1.18.4 node 8.11.1
I'm not on 10.12.0, so not sure it's that. I am on OSX.
I'm not sure if nodemon is attempting to restart before the PID kill has completed, but in my tests it looked like that might be the case. I checked the PID before a restart and had the app log out the PID when SIGUSR2 was called. As you can see from the screenshot, PID was called and then then the EADDRINUSE error was thrown, but after checking the PID's again, nodemon was had actually succeeded in restarting and a process WAS active.

I also have this issue Nodemon v1.18.4
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up.
Thank you for contributing <3
Same issue with "nodemon": "^1.18.6"
Um鈥o one has actually provided an app.js to replicate with. Without that, it can't be replicated and can't be debugged.
I have this example set up - https://codesandbox.io/s/o4wzoqk9o6
It runs fine in the sandbox, but if I download it and run it on my mac it will fail with Error: listen EADDRINUSE :::8080
Tried running in both my default environment and with the sandbox versions. Both fail.
Node v10.6.0|v8.11.2
NPM 6.1.0|5.6.0
Mac OS 10.13.6 - shell: zsh 5.3 (x86_64-apple-darwin17.0)
Same problem here.
Here is the sample "project" - https://gitlab.com/alexsmit/sample. Tried to create as smaller project as possible. I hope it will help.
(not expected): If you modify server index.js, save it you will get a mentioned above error. And event not captured :(
(expected): If you modify client code (react, excluded) works fine because it is excluded.
Environment: Linux, Node 8.11.4
I tried multiple things thinking it might of been my environment but I am seeing the same thing even after a clean ubuntu 18.04 install.
Getting EADDRINUSE 127.0.0.1:1337 on file change. (Ctrl+C and restart works).
nvm install -lts ( node -v = v10.13.0 also tried on v8.13.0 )Can't get it to update on change without crashing.
Fairly sure this is directly related to #1459 et al. [email protected] 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).
Working for me. Thanks !!!!
Just to confirm that 1.18.7 indeed fixed the problem for me. Thanks.
Working too. Thanks
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
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});
});
I figured out that after code change not only node process still running, but the parent nodemon process too. Try killing both nodemon parent and node proccesses and rerun nodemon. For now it helped me, but it happened not first time.
same here in v2.0.4
Most helpful comment
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});});