报错:“Visual Studio Code is unable to watch for file changes in this large workspace“ (error ENOSPC)
When you see this notification, it indicates that the VS Code file watcher is running out of handles because the workspace is large and contains many files. Before adjusting platform limits, make sure that potentially large folders, such as Python .venv
, are added to the files.watcherExclude
setting (more details below). The current limit can be viewed by running:
cat /proc/sys/fs/inotify/max_user_watches
The limit can be increased to its maximum by editing /etc/sysctl.conf:
sudo vi /etc/sysctl.conf
Adding this line to the end of the file:
fs.inotify.max_user_watches=524288
The new value can then be loaded in by running:
sudo sysctl -p
While 524,288 is the maximum number of files that can be watch