Skip to content

Error: ENOSPC: System limit for number of file watchers reached – How to fix this NPM error?

In this post, we will learn how to fix the error when you run npm start command for starting a node.js app – Error: ENOSPC: System limit for number of file watchers reached.

Advertisements

The error implies that the limit for file watchers has been reached. If you are using inotify watchers to watch changes on your file system, there are chances the limit would be reached. The npm libraries like chokidar usually needs more file watchers.

To fix the error Error: ENOSPC: System limit for number of file watchers reached, simply increase the inotify file watchers count on your operating system by running the following command.

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

This command sets the inotify watchers limit to 512 and makes it permanent. Note that you can increase this count if your face this error again.

See also  How to get query strings and path parameters in Express.js?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.