In VS Code, I have a Vue project with less than 50 files but upon running the dev server VS Code throws Error: ENOSPC: System limit for number of file watchers reached
.
My VS Code Watcher Exclude settings have the following ignore patterns.
**/.git/objects/**
**/.git/subtree-cache/**
**/node_modules/**
I tried to figure out what files could possibly be setting me over the max_user_watches limit on my machine, which is 8192.
With a StackExchange answer from user "mosvy" and a script derived from that answer by another user "oligofren", I've found that the following sources are likely causing this.
| Watchers | Source |
| -------- | ------ |
| 4033 | /usr/share/code/code --max-old-space-size=3072 /usr/share/code/resources/app/extensions/node_modules/typescript/lib/tsse |
| 3889 | /usr/share/code/code /usr/share/code/resources/app/extensions/node_modules/typescript/lib/typingsInstaller.js --globalTy |
| 99 | /usr/share/code/code /usr/share/code/resources/app/out/bootstrap-fork --type=watcherService |
I'm not sure why any of these are being watched, but the first two seem to be ignoring VS Code's Watcher Exclude setting of **/node_modules/**
If possible, is it safe to exclude all three of these in the Watcher Exclude settings of VS Code?
I don't want to break my VS Code install.
Update
The Watcher Exclude settings above are what VS Code has listed as default. When I specifically add
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/**": true
}
to the settings.json file, the two node_modules sources listed above are removed and I no longer get the error.
Update 2
After restarting VS Code and verifying that settings.json still included the changes from my last update, the two node_modules sources from before are no longer being excluded.