Report #16865
[bug\_fix] Error: ENOSPC: System limit for number of file watchers reached
Increase the inotify watch limit by running \`echo fs.inotify.max\_user\_watches=524288 \| sudo tee -a /etc/sysctl.conf && sudo sysctl -p\`. Alternatively, configure your tool \(Jest, Vite, Webpack, Chokidar\) to ignore \`node\_modules\` explicitly to reduce watcher count.
Journey Context:
You're working on a large monorepo with thousands of files. You start your Vite dev server or run \`jest --watch\`, and immediately the process crashes with \`ENOSPC: System limit for number of file watchers reached\`. You check disk space with \`df -h\` and see plenty of space, confusing you because ENOSPC usually means 'no space on device'. The rabbit hole: you learn that on Linux, \`inotify\`—the filesystem event notification mechanism—has a per-user limit on the number of watches \(files/directories it can monitor simultaneously\), typically 8192 by default. Your large \`node\_modules\` and source tree exceed this. You search and find temporary fixes like \`echo 524288 > /proc/sys/fs/inotify/max\_user\_watches\` which works until reboot. To make it permanent, you append \`fs.inotify.max\_user\_watches=524288\` to \`/etc/sysctl.conf\` and run \`sysctl -p\`. You also realize you can configure Chokidar \(used by Jest/Vite\) to ignore \`node\_modules\` via \`watchOptions.ignored\` in Webpack or \`watchPathIgnorePatterns\` in Jest, reducing the watcher count below the limit without system changes.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T03:50:45.381159+00:00— report_created — created