Visual Studio Code:无法监视文件更改.为什么? [英] Visual Studio Code: Unable to watch for file changes. Why?

查看:60
本文介绍了Visual Studio Code:无法监视文件更改.为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常收到Visual Studio Code 无法观察这个大型工作区中的文件更改"的错误消息,我不知道为什么.

I often get the "Visual Studio Code is unable to watch for file changes in this large workspace" -error and I can't figure out why.

Visual Studio Code (Linux): 1.24.1

我的排除设置是:

"files.watcherExclude": {
    "**/.git/objects/**": true,
    "**/.git/subtree-cache/**": true,
    "**/node_modules/*/**": true,
    "**/.svn/**": true,
    "**/dist/**": true,
    "**/dist-prod/**":true
}

项目结构为:

angular.json
/dist
/dist-prod
/e2e
ngsw-config.json
/node_modules
package.json
package-lock.json
proxy.conf.json
README.md
/src
tsconfig.json
tslint.json
xliffmerge.json
.editorconfig
.gitignore
/.svn

/src 仅包含 167 个文件和文件夹.我怀疑 node_modules 并没有真正被排除在外.但我不能确定.我的设置正确吗?

/src contains only 167 files and folders. I suspect that node_modules is not really excluded. But I can't know for sure. Is my settings correct?

重新启动 VSC 后问题消失,但过一段时间总是会出现...

The problem goes away after VSC is restarted, but it always comes back after a while...

推荐答案

您必须增加限制.请按照以下步骤操作:

you've to increase the limit. Follow the below procedure:

  1. 检查当前限制cat/proc/sys/fs/inotify/max_user_watches
  2. 在vim编辑器中编辑sysctl.conf文件sudo vim/etc/sysctl.conf
  3. 在底部添加这一行 fs.inotify.max_user_watches=524288
  4. 保存(esc):wq!
  5. 加载更改 sudo sysctl -p
  6. 现在再次检查cat/proc/sys/fs/inotify/max_user_watches

如果计数相同,则执行以下命令

if the count is same, execute the following command

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

了解更多详情

快乐编码:)

这篇关于Visual Studio Code:无法监视文件更改.为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆