Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I just installed Node.js on my Ubuntu 14.04 operating system for the first time. I also installed npm. The next step in my installation process was installing nodemon. This all worked out fine.


But, when I run nodemon by typing nodemon app.js in my command line, I get the following error...

[nodemon] 1.8.1 [nodemon] to restart at any time, enterrs [nodemon] watching: *.* [nodemon] startingnode app.js [nodemon] Internal watch failed: watch ENOSPC

In the command line below the error...

alopex@Alopex:~/Desktop/coding_dojo/week-9/javascript/node/testing_node$ Hello World

Why is this happening? Is this normal behavior for nodemon? If not, how can I fix it?


Side notes...

1) app.js is a Javascript file with console.log(111) inside of it.
2) node version is v0.10.25
3) npm version is 1.3.10
4) nodemon version is 1.8.1
5) ubuntu version is...

Distributor ID: Ubuntu
Description:    Ubuntu 14.04.3 LTS
Release:    14.04
Codename:   trusty
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
528 views
Welcome To Ask or Share your Answers For Others

1 Answer

It appears that my max ports weren't configured correctly. I ran the following code and it worked...

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

What this command does is to increase the number of watches allowed for a single user. By the default the number can be low (8192 for example). When nodemon tries to watch large numbers of directories for changes it has to create several watches, which can surpass that limit.

You could also solve this problem by:

sudo sysctl fs.inotify.max_user_watches=582222 && sudo sysctl -p

But the way it was written first will make this change permanent.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...