Home / Blog / Post
Gatsby JS debugging - limit of file watchers reached on Ubuntu / Debian linux system
28 December, 2020 by
Gatsby JS debugging - limit of file watchers reached on Ubuntu / Debian linux system
Goran Štimac

This problem is caused by the way Gatsby.js works, generates static files and optimizes photos, which easily exceeds the defined Listen limit for the number of files that the Linux OS monitors per directory.

Namely, the Linux OS uses Listen inotify to monitor file changes in directories. Therefore, it is not uncommon to encounter a system limit in the number of files you can monitor. For example, the inotify limit on Ubuntu Lucid (64bit) is set to 8192.

What is the current limit of your system you can find out by ordering:

cat /proc/sys/fs/inotify/max_user_watches

When the defined limit is not sufficient to track file changes in the directory, you must increase the limit in order for Listen to work properly.

You can set a new temporary limit with the command:

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

If you want to permanently change the Listen limit, use the command:

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

Ako i dalje imate problema s Listen provijerite vrijednosti max_queued_events i max_user_instances