Vite
Vite hit the Linux file watcher limit
Error: ENOSPC: System limit for number of file watchers reached
Vite can crash on Linux when the dev server needs to watch more files than the operating system allows.
Observed message
Error: ENOSPC: System limit for number of file watchers reached
Why it happens
- The project contains more watched files than the Linux inotify limit allows.
- Large asset or generated directories are being watched unnecessarily.
- The dev server is running on a host with low default watcher limits.
How to fix it
- Increase the Linux file watcher limit such as fs.inotify.max_user_watches and reload the setting.
- Exclude heavy directories from Vite file watching with server.watch.ignored when they do not need live reload.
- Use polling only if necessary, since it consumes more CPU than normal file system events.