Gatsby.js error fix linux - System limit for number of file watchers reached

August 14, 2019 Post tags: error fix | gatsby.js | linux |

This problem is due to the way Gatsby.js works, generates static files and optimizes photos, it may exceed the defined Listen limit for the number of files that Linux OS tracks per directory.

Listen uses inotify by default on Linux to monitor directories for changes. It's not uncommon to encounter a system limit on the number of files you can monitor. For example, Ubuntu Lucid's (64bit) inotify limit is set to 8192.

You can get your current inotify file watch limit by executing:

cat /proc/sys/fs/inotify/max_user_watches

When this limit is not enough to monitor all files inside a directory, the limit must be increased for Listen to work properly.

You can set a new limit temporary with:

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

If you like to make your limit permanent, use:

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

You may also need to pay attention to the values of max_queued_events and max_user_instances if Listen keeps on complaining.

Product - ORI PWA

Speed up your business with PWA application. PWA can be your website and mobile application for both Android and iOS.

We have taken special care to include everything you need. Reduce your headaches both during production and regular maintenance.

Our PWA can pull data from anywhere, custom RESTFUL api, Word Press, Magento, Drupal, Contentful, XML, JSON, spreadsheets and more. We can organize, display and process pulled data per your liking.

Do you want a hassle-free, modern and super fast website?

Find out more

Comments

ORI provides full business web identity creation service! Contact us