If you see ENOSPC: System limit for number of file watchers reached, your Linux inotify watcher limit is too low for your project size.
This happens a lot with Next.js, Vite, Webpack, and Jest watch mode.
Why this error appears
Your dev tools watch many files for changes. Big repos can quickly exceed Linux default watcher limits.
Common signs:
- dev server fails to start
- hot reload stops working
- Jest watch crashes
Quick fix command
Increase watcher limits with:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
echo fs.inotify.max_user_instances=1024 | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
Then restart your terminal and rerun your dev server.
Verify the values
Check current limits:
cat /proc/sys/fs/inotify/max_user_watches
cat /proc/sys/fs/inotify/max_user_instances
You should see the updated numbers.
Temporary fix (without reboot)
If you do not want to edit config right now:
sudo sysctl fs.inotify.max_user_watches=524288
sudo sysctl fs.inotify.max_user_instances=1024
This may reset after reboot, so permanent config is better.
WSL note
If you use WSL, run these commands inside your WSL distro shell, not in Windows PowerShell.