Nodemon leaves old server running when restarting
See original GitHub issuenodemon -v: 2.0.2node -v: v10.15.2- Operating system/terminal environment: Windows 10 / VSCode
- Using Docker? What image: No
- Command you ran:
nodemon
Appeared suddenly. Can run nodemon, save a file once to restart the server, and then the new server seems to fail to handle any requests. When closing this server and attempting to restart it, says the address is already in use.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:18 (4 by maintainers)
Top Results From Across the Web
Nodemon: Error: listen EADDRINUSE: address already in use
From my experience this error, @akkhil seems to be the most correct. I save, restarting the server with nodemon. I sometimes get the...
Read more >Using nodemon with NodeJS Servers - YouTube
This video explains how you can make your development process more efficient by automatically restarting your web server after ever file ...
Read more >nodemon events — run tasks at server start, restart, crash, exit
Not very well unfortunately. Because nodemon doesn't run npm start-dev when it restarts the server, the pre command isn't run either. So this...
Read more >Nodemon Not Killing Node Before Trying To Restart ... - ADocLib
My experience here is that Ctrl+C leaves a node instance running in the when you try to restart 'nodemon server.js' or just 'node...
Read more >Implementing a secure password reset in Node.js
mongoose to as a driver to interface with MongoDB database; nodemailer to send emails; nodemon to restart the server when a file changes ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I think it is a problem with system speed and the way the process restart on file changes. It seems to happen too quickly and port is still running IMO.
My work around was to set
port:const port = process.env.PORTthen use the variable inapp.listen(port).In package.json I changed my script:
"start": "PORT=3000 nodemon app.js"This seems to work for now.
I can confirm with version 2.0.2 and 2.0.3. I am having the same issues:
The project I am working on is at this repo.
For the time being I have included a kill port script in the
startscript but obviously this is annoying.