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, enter
rs [nodemon] watching: *.* [nodemon] starting
node 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
ベストアンサー1
It appears that my max ports weren't configured correctly. Here is the fix.
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.
More explanation of how it solves the problem:
echo fs.inotify.max_user_watches=524288
it increase the number of watches of nodemon as you made some changes in your project and
sudo tee -a /etc/sysctl.conf && sudo sysctl -p is sysctl
command for configure kernel parameters at runtime.
More on https://wiki.archlinux.org/title/kernel_parameters
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.