Nodemon无变更频繁重启求助:VSCode操作触发、致电脑崩溃
Hey there, I’ve dealt with this exact Nodemon headache before—it’s so frustrating when it spams restarts for no obvious reason and eventually grinds your machine to a halt. Let’s walk through the most reliable fixes:
Common Causes & Solutions
1. Ignore VSCode’s Temporary/Cache Files
VSCode’s sidebar search and background processes often tweak hidden cache files or metadata in the .vscode folder. Nodemon picks up these tiny, non-code changes as "updates."
Create a nodemon.json file in your project root with these ignore rules:
{ "ignore": [".vscode/*", "*.log", "node_modules/", ".git/*"] }
This tells Nodemon to skip monitoring VSCode’s config/cache folders, log files, and other non-source-code directories.
2. Add a Detection Delay
Sometimes file systems take a split second to stabilize after minor operations (like search indexing). Adding a delay gives Nodemon time to avoid false positives.
Modify your Nodemon start command to include the --watch-delay flag:
nodemon --watch-delay 1000 your-server-file.js
The value is in milliseconds—1000ms (1 second) is usually enough to prevent premature restarts.
3. Switch to Legacy Watch Mode
Modern file system monitoring (Nodemon’s default) can have quirks on certain setups (like WSL, macOS with specific security settings, or network drives). Enabling legacy watch (polling mode) bypasses these issues:
nodemon --legacy-watch your-server-file.js
Note: Polling uses slightly more CPU, but it’s a reliable fix for false restart triggers.
4. Troubleshoot VSCode Plugins
Some VSCode extensions (advanced search tools, cache optimizers, or file sync plugins) might be modifying file attributes in the background. Try:
- Disabling all non-essential plugins temporarily
- Restarting VSCode and Nodemon
- Re-enabling plugins one by one to spot the culprit
The Issue in Action
Here’s the screenshot of the problem you described:
内容的提问来源于stack exchange,提问作者Giedrius Lauru拧ka

