Error: ENOSPC: System limit for number of file watchers reached, watch

Error: ENOSPC: System limit for number of file watchers reached, watch

There are some tips in the comments and I brought them to update this question. If you’re facing this problem, then you are probably using a Linux distro and your project is hitting your system’s file watchers limit.

On execute NPM RUN DEV at ubuntu, and the system show the error “Error: ENOSPC: System limit for number of file watchers reached, watch”, follow the steps:

Check your current inotify file watch limit by executing:

cat /proc/sys/fs/inotify/max_user_watches

You can set a new limit temporarily with:

sudo sysctl fs.inotify.max_user_watches=131070
sudo sysctl -p

Or you can set a permanent limit:

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

Here we are setting 131070 file limit (as suggested by @Dmitriy in the comments). If this limit doesn’t works for your system you can twice this number.

This documentation provides more technical details.

Error: ENOSPC: System limit for number of file watchers reached, watch solved