-
Notifications
You must be signed in to change notification settings - Fork 147
[nodemon] Error: listen EADDRINUSE: address already in use #676
Comments
Hi @alex996! Thank you for digging into this! I could repro the issue on macOS 10.14.1 on Node 11.2.0 with |
@jdalton Thanks so much for the info. I'll follow up with the issues in |
windows 10 kill all about node.js in back |
I was using nodemon 1.17.5 by following a course, Now I have updated with the latest version 1.19.x, which has fixed my problem. |
I have no idea how this matter but my failing setup looked like this: app.js file (entry point of the app)
and my command to start the server was:
now I've changed the first line when I defined
and now I'm defining the port right before starting nodemon like this:
So essentially before my |
In my case, Whenever I am saving the code, it is showing this port is already in use. |
Sometimes, it's just because nodemon is restarting faster than the process is being killed. For example, if there is some (slow) logic in server.on('close') or server.on('SIGINT'). |
I have solved this issue by adding below in my package.json for killing active PORT - 4000 (in my case)
|
I also got this error when I ran the project with VScode terminals and closed multiple working terminals without killing them or without stopping the server. Killing every previous terminal and starting with a new terminal solved this for me. |
I had the same problem. Realized that I was using global nodemon version. Once I installed it locally, the problem was gone. |
I used this to fix the same problem
https://www.npmjs.com/package/nodemon |
Thank's @AbdelhakAj, It works! |
Thank you, @mishra-vikash! I was also using v1.17.5, as instructed by the course I am following. I upgraded to version 1.19 and the problem no longer occurring. |
That
Thank you mate,that worked , I was having this issue in this version nodemon": "^2.0.12 |
I'm running into an error in
nodemon
today, which only happens withesm
using-r
from the CLI. Here's a dead-simple reproduction:When I run
yarn dev
from the terminal, and then doCtrl+S
inapp.js
in the editor, I getYou can see that the app boots correctly, but as soon as any file changes,
nodemon
can't restart it. In the meantime, the app still continues to run in the background. If I doCtrl+C
, it quits, but there's no more process on port3000
, so killing it by portfuser -k 3000/tcp
doesn't do anything.I found that
esm
, i.e. if I change"dev": "nodemon -r esm app"
to"dev": "nodemon app"
, the error goes away, andnodemon
restarts correctlyesm
usingrequire("esm")(module)
syntax instead of-r
express
or any web server (because the port is not used)11.2.0
,11.1.0
, and10.13.0
Tried rebooting, reinstalling Node, removing
yarn.lock
, then removing and re-installingnode_modules
, locking to older versions ofesm
,nodemon
, andexpress
... I'm out of options here.At first, I thought this was
nodemon
's fault, so I scavenged many threads with this error, but to no avail. Then I noticed that the error appears to be emitted fromesm
, so I thought I'd post here. Sorry, if I'm posting in a wrong repo; it seems the culprit lies in this library. Any clues are appreciated!The text was updated successfully, but these errors were encountered: