This error is very common on Linux when working with large projects (which has many dependencies in ( node_modules).
The error ENOSPC: System limit for number of file watchers reached your operating system has hit the limit on the number of files it can monitor for real-time changes (something tools like Webpack or Vite do constantly).
To fix it, you need to increase the inotify limit on your system. Here is how to do it:
Quick Solution (Temporary until restart)
Run this command in your terminal to increase the limit immediately:
sudo sysctl fs.inotify.max_user_watches=524288
Try starting your app again; it should work now.
Permanent Solution (Persists after restart)
To avoid having to type the command every time you restart your computer:
- Add the configuration to the
sysctl.confAdd the configuration to the (or you can create a file in.d):
echo "fs.inotify.max_user_watches=524288" | sudo tee -a /etc/sysctl.conf
- Apply the changes:
sudo sysctl -p
With this, the file watcher limit will be high enough to handle all the files in your project and its dependencies.
