ENOSPC node filesystem ai_generated true

Error: ENOSPC: System limit for number of file watchers reached

ID: node/enospc-system-limit-watchers

Also available as: JSON · Markdown
96%Fix Rate
97%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
20 active

Root Cause

Linux inotify watcher limit exhausted, common with large projects using webpack/vite/jest --watch.

generic

Workarounds

  1. 97% success Increase inotify watcher limit: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
    Permanently increases the limit to 524288

    Sources: https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers

  2. 88% success Add large directories to watchOptions.ignored in webpack/vite config
    Ignore node_modules and build output directories from file watching

Dead Ends

Common approaches that don't work:

  1. Disabling file watching entirely 75% fail

    Breaks hot-reload and watch mode development workflow

  2. Restarting the dev server repeatedly 80% fail

    Temporary; watchers accumulate again

Error Chain

Frequently confused with: