Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nodemon Error: System limit for number of file watchers reached

People also ask

How do I increase file watchers?

Increase the limit The limit can be increased to its maximum (524288) by editing /etc/sysctl. conf and appending this line to the file. The value appended will be printed to the console if the append worked. This should be the only time you have to do this until you have to set up a new system again.

How do I fix error Enospc system limit for the number of watchers reached watch?

You can fix it, that increasing the amount of inotify watchers. Then paste it in your terminal and press on enter to run it.

What is Enospc error?

ENOSPC means that there is no space on the drive. Perhaps /tmp is full? You can configure npm to use a different temp folder by setting npm config set tmp /path/to/some/other/dir , or maybe delete everything out of the /tmp folder. Source: npm 1.1.


If you are using Linux, your project is hitting your system's file watchers limit

To fix this, on your terminal, try:

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

I sometimes get this issue when working with VSCode on my Ubuntu machine.

In my case the following workaround helps:

stop the watcher, close VScode, start the watcher, open VSCode again.


You need to increase the inotify watchers limit for users of your system. You can do this from the command line with:

sudo sysctl -w fs.inotify.max_user_watches=100000

That will persist only until you reboot, though. To make this permanent, add a file named /etc/sysctl.d/10-user-watches.conf with the following contents:

fs.inotify.max_user_watches = 100000

After making the above (or any other) change, you can reload the settings from all sysctl configuration files in /etc with sudo sysctl -p.


In order to test the changes, I set temporary the parameter with the value 524288.

sysctl -w fs.inotify.max_user_watches=524288

then I proceed to validate :

npm run serve

And the problem was solved, in order to make it permanent, you should try to add a line in the file "/etc/sysctl.conf" and then restart the sysctl service :

cat /etc/sysctl.conf |tail -n 2
fs.inotify.max_user_watches=524288

sudo systemctl restart systemd-sysctl.service

I had the same problem, however mine was coming from webpack. Thankfully they hd a great solution on their site:

For some systems, watching many files can result in a lot of CPU or memory usage. It is possible to exclude a huge folder like node_modules using a regular expression:

webpack.config.js

module.exports = {
  watchOptions: {
    ignored: /node_modules/
  }
};