Outcome: You’ll raise Linux inotify watch limits so VS Code and other dev tools can monitor large projects without ENOSPC watcher errors.

Who this is for: Linux developers using VS Code, nodemon, webpack, or similar tools on big repos/monorepos.

Time required: About 1 minute.

Quick Answer

Increase fs.inotify.max_user_watches in /etc/sysctl.conf (or a sysctl drop-in), apply it with sudo sysctl -p, then restart VS Code. This removes the common “file watchers limit reached” bottleneck on large codebases.

Prerequisites

  • Linux machine (Ubuntu, Fedora, Arch, etc.)
  • sudo access
  • A project that triggers file watcher errors (for example ENOSPC)

Step-by-step: Increase inotify watches for large projects

  1. Check your current watcher limit.
    Run:

    cat /proc/sys/fs/inotify/max_user_watches

    Expected result: You see a number (often 8192 or 16384 on defaults).

  2. Add a higher persistent limit.
    Run:

    echo 'fs.inotify.max_user_watches=524288' | sudo tee -a /etc/sysctl.conf

    Expected result: The new setting is appended to the file.

  3. Apply the new kernel setting now.
    Run:

    sudo sysctl -p

    Expected result: Terminal prints the updated inotify key/value.

  4. Verify the new value.
    Run:

    cat /proc/sys/fs/inotify/max_user_watches

    Expected result: It now returns 524288 (or your chosen higher value).

  5. Restart your editor/dev process.
    Close and reopen VS Code (or reload window), then rerun your watcher-based tooling.

    Expected result: File watching and live reload work without watcher-limit errors.

Expected result checks

  • VS Code no longer warns about file watcher limits in your large workspace.
  • Live reload/hot reload tools detect file changes again.
  • cat /proc/sys/fs/inotify/max_user_watches shows the higher value after reboot.

Common mistakes

  • Using a temporary command only: sudo sysctl fs.inotify.max_user_watches=... resets after reboot unless persisted.
  • Typos in key name: a misspelled fs.inotify.max_user_watches won’t apply.
  • Forgetting to restart tools: existing editor sessions may keep old watcher state.
  • Editing the wrong file: distro-specific sysctl drop-ins can override values.

Quick troubleshooting

  • Value didn’t change: run sudo sysctl -p again and check for parse errors in output.
  • Still getting ENOSPC: raise further to 1048576 if needed on very large monorepos.
  • Works until reboot: ensure the line exists in a persistent sysctl config file.
  • WSL users: apply the setting inside your Linux distro environment, then restart that session.

Reference links

Related tech tricks

Next step

After this fix, clean up your workspace watcher load by excluding giant generated folders (like node_modules/.cache or build outputs) in your editor settings for even smoother performance.