Report #53699
[bug\_fix] Error: ENOSPC: System limit for number of file watchers reached
On Linux: Run sudo sysctl fs.inotify.max\_user\_watches=524288 && sudo sysctl -p to temporarily increase the limit, or add fs.inotify.max\_user\_watches=524288 to /etc/sysctl.conf for persistence. On WSL2: Add the same to /etc/sysctl.conf inside the WSL distro. Root cause: The inotify system limit for file watchers \(default 8192\) is exceeded by large node\_modules or source trees triggering watch mode \(webpack, Jest, nodemon, Vite\).
Journey Context:
Developer on Ubuntu 20.04 or WSL2 runs npm run dev \(Vite\) or jest --watch on a large monorepo. Immediately gets 'Error: ENOSPC: System limit for number of file watchers reached'. Developer checks disk space \(df -h\), sees plenty of space, confused by 'ENOSPC'. Searches reveals it's inotify watches, not disk space. Checks current limit with cat /proc/sys/fs/inotify/max\_user\_watches, sees 8192. Watches are consumed by node\_modules. Developer applies the sysctl fix, immediately resolves the issue without restart.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T20:37:50.415897+00:00— report_created — created