Blog članak

Fix 'Limit of File Watchers Reached' in Gatsby on Ubuntu or Debian

Increase Linux inotify limits to fix Gatsby's 'limit of file watchers reached' error during local development on Ubuntu or Debian.

Sam tekst članka trenutačno je i dalje na engleskom, ali hrvatska navigacija, arhiva i povezani sadržaji ostaju dostupni.

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.

Nastavite čitati

Prvo po zajedničkim kategorijama, a zatim po najjačem preklapanju u tagovima.