Nodemon internal watch failed error?
Asked Answered
E

6

8

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??

Efik answered 25/10, 2017 at 16:57 Comment(2)
the port 3000 is already used by another processSkep
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.Efik
S
11

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.

Scalawag answered 31/10, 2017 at 23:1 Comment(0)
D
5

In my case,

Error: [nodemon] Internal watch failed: EMFILE: too many open files, watch

Solution:

  1. I close the vs code,
  2. Reopen it, and solve the problem.
Deadlock answered 18/1, 2023 at 4:38 Comment(2)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Architectonic
Worked for me too. it was that simple! Wasted one hour.Tirrell
M
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
Madonna answered 12/2, 2019 at 7:47 Comment(0)
A
1

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

npm install -g nodemon

And it worked 😃

Artima answered 14/5, 2021 at 14:21 Comment(1)
helped me too, but in my case it was installed locallyAbstractionism
R
0

I've also faced this issue and I have tried all the solutions mentioned above but the solution works for me is just close the IDE and restart again the IDE it will help me.

Rola answered 11/1, 2023 at 14:29 Comment(0)
T
0

This issue is occurs because nodemon is not installed properly please follow the instructions:

  • check your nodemon by using command nodemon -v.

version:
2.0.22

  • If you received nodemon version then it's working well otherwise use npm install nodemon -g command to install package.

  • use lsof -i -n -P | grep node command to check your node.js running PORTS such as:

output:
node 460517 adil 20u IPv6 13299837 0t0 TCP *:3003 (LISTEN)

  • if you received then kill unusable running PORTS by using kill -9 460517 command.

  • Run nodemon ./index.ts or npm start command.

Issue resolved.

Triley answered 23/6, 2023 at 12:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.