6

I don't know what happened but suddenly my Nodemon starting to show the error.

nikhil@nikhil-Lenovo-Z50-70:~/Desktop/dominos$ nodemon server.js
[nodemon] 1.12.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node server.js`
[nodemon] Internal watch failed: watch /home/nikhil/Desktop/dominos 
ENOSPC

Even though after that my program runs fine. But when I close this project1 and runs another project2 on the same port then this error occurs

Error: listen EADDRINUSE :::3000
at Object.exports._errnoException (util.js:1024:11)
at exports._exceptionWithHostPort (util.js:1047:20)
at Server.setupListenHandle [as _listen2] (net.js:1319:14)
at listenInCluster (net.js:1367:12)
at Server.listen (net.js:1467:7)
at Object.<anonymous> (/home/nikhil/Desktop/dominos/server.js:533:8)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3

And then my old project1 would remain open and my new project2 cannot be started until I manually kill the process.

Any idea why this is happening??

Nikhil
  • 356
  • 3
  • 19
  • the port 3000 is already used by another process – Lorenzo Marcon Oct 25 '17 at 16:59
  • Yes If I kill the process by using the Kill Command Then my projects run fine but this problem started to show from few days before that I was able to run the countless application with nodemon on the same port. – Nikhil Oct 25 '17 at 17:02

3 Answers3

10

Assuming you're on linux, the issue could be that you have too many open watchers. Run this command:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

and try again.

Credit: this answer.

ronme
  • 1,124
  • 1
  • 11
  • 16
2

This issue is occurring because already another process or terminal use your same port

kill all node by using following command

killall node

start nodemon by using following comand

nodemon server.js
Eric Aya
  • 69,000
  • 34
  • 174
  • 243
Ganesh Apune
  • 157
  • 6
0

I had this same error. Node worked, but not nodemon. All I did was:

npm install -g nodemon

And it worked

Rob
  • 177
  • 2
  • 7