GoranStimac.com

How can I help

Stay informed and learn

Let's connect

Gatsby JS debugging - limit of file watchers reached on Ubuntu/Debian Linux system

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 with command:

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 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

If you still have problems with Listen check the values max_queued_events and max_user_instances.

Newer post

Amazon Lightsail now offers easier integration of CDN distribution to speed up content delivery

Older post

How to add Google fonts to Ubuntu/Debian Linux system?

comments powered by Disqus

Looking for an IT professional?

Book a call Email me