You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Nodemon报错「Internal watch failed」求助:执行方案后问题仍存在

Fixing "nodemon Internal watch failed: ENOSPC" Error Even After Adjusting inotify Limits

Hey there, let's tackle this stubborn ENOSPC issue with nodemon that's still popping up even after you tried killing Node processes and increasing the inotify watch limit. I've run into this exact headache before, so here are some targeted steps to get things working again:

  • Verify your inotify limit actually took effect
    Sometimes the sysctl command might not apply correctly, or there could be a hidden typo. Run this to check the current max watch count:

    cat /proc/sys/fs/inotify/max_user_watches
    

    If it doesn't show 582222, re-run the setup commands carefully:

    echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf
    sudo sysctl -p
    

    Also, keep an eye out for override files in /etc/sysctl.d/—some systems store inotify settings there instead, which might be resetting your value.

  • Hunt down other processes hogging inotify watches
    Node isn't the only culprit! Apps like IDEs, file sync tools, or even desktop file managers can chew through hundreds of watch slots. Use this command to see which processes are using the most watches:

    sudo find /proc/*/fd -lname anon_inode:inotify | cut -d/ -f3 | xargs -I '{}' -- ps --no-headers -o '%p %U %c' -p '{}' | uniq -c | sort -nr
    

    If you spot a non-Node process with a massive number of watches, close it temporarily to free up resources for nodemon.

  • Stop nodemon from watching node_modules
    Watching the entire node_modules directory is almost never necessary and wastes tons of watch slots. Create or update a nodemon.json file in your project root to exclude it:

    {
      "ignore": ["node_modules/"]
    }
    

    Or run nodemon directly with the ignore flag:

    nodemon --ignore node_modules/ your-app-entry-file.js
    

    This cuts down the number of files nodemon tracks drastically, which might push you under the watch limit even if your initial increase wasn't enough.

  • Reboot your system (last-ditch fix)
    Occasionally, system-level changes don't fully kick in until a restart. If all else fails, rebooting will reset all inotify watch counts and ensure your sysctl settings are loaded properly.

内容的提问来源于stack exchange,提问作者user9630712

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 08:59:47