Visual Studio Code is unable to watch for file changes in this large workspace

2020-12-04 16:16:20

参考地址 1 Visual Studio Code on Linux

参考地址2  How Meteor watches your files for changes

解决办法   直接输入

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


When you run your Meteor app in local development mode, the meteor command-line tool watches your source code for changes. (This page describes the behavior as of Meteor 1.0.2.1.)

There are two different strategies that meteor uses for change watching: efficient system-specific APIs like inotify (on Linux) and kqueue (on OSX), and a slower but more reliable "stat polling" method. inotify/kqueue is less reliable because it does not work on every system, and sometimes meteor can't even tell if it doesn't work. Stat polling is slower in two ways: it only looks for changes once every "polling interval", and the actual check that it does consumes more CPU.

By default, meteor uses both inotify/kqueue and stat polling, with a polling interval of 5 seconds; if it detects that inotify/kqueue isn't working, it uses a polling interval of 0.5 seconds.

This means that on most systems, changes are detected very quickly by inotify/kqueue. On systems where inotify/kqueue doesn't work, the stat polling fallback still works, but it does use more CPU than if inotify/kqueue works; and if meteor was unable to automatically detect that inotify/kqueue didn't work, you may have to wait up to 5 seconds for stat polling to notice file changes.

The rest of this wiki page describes two ways in which you can improve the performance of Meteor file watching.

  • There are some circumstances where inotify doesn't work (causing meteor to fall back to the CPU-hungry 0.5 second poll), but a simple configuration change will make inotify work.

  • There are some circumstances where inotify/kqueue doesn't work but meteor is unable to detect this, so only the high-latency 5 second poll happens. While you can't make inotify/kqueue work in this case, you can at least tell meteor to use a faster poll to detect changes sooner.

Making inotify work on Linux systems where it doesn't work

(Note: this section is Linux-specific: it will not work on OS X, and the warning message below should not be displayed there. If you do see this warning on OS X, please file a bug!)

Linux users may see a message saying:

=> It looks like a simple tweak to your system's configuration will make many
   tools (including this Meteor command) more efficient. To learn more, see
   https://github.com/meteor/meteor/wiki/File-Change-Watcher-Efficiency

This message means that meteor tried to use the Linux inotify API to watch for file changes, but you've already reached the system-wide limit for the number of files that you can watch (probably in a different program entirely!).

Fortunately, this is easy to fix. Just run this command at your shell, entering your password when prompted:

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

(Alternatively, use another mechanism to edit /etc/sysctl.conf as root and add the line fs.inotify.max_user_watches=524288 to the bottom, then run sudo sysctl -p.)

After running these commands, you should no longer see the "simple tweak" message when running meteor. (If you still do, file a bug!) Meteor is now using the efficient inotify API

If you do not have superuser access on your computer, you won't be able to run these commands. In that case, you may set the METEOR_WATCH_FORCE_POLLING environment variable as described in the next section, which will hide the warning and not try to use inotify at all.

Running meteor on a network/shared filesystem

Some filesystems don't support inotify/kqueue at all, but also don't allow meteor to detect this error case. In this situation, meteor will still detect file changes with the stat poller at the 5 second polling interval, but you may want to poll more often in order to detect changes faster.

The most common filesystems with this issue are network or shared filesystems like NFS or VirtualBox shared folders (vboxsf). For example, if you are using Vagrant or a similar tool to run meteor inside a virtual machine, and you are sharing your app source directory between your host machine and the VM, inotify may be unable to detect changes made on your host machine. The symptom will be that meteor doesn't even start trying to rebuild your app until up to 5 seconds after you make the change.

To improve this situation, on the machine where you are running meteor (eg, inside your VM), set the METEOR_WATCH_FORCE_POLLING environment variable to any non-empty value. For example, put the line METEOR_WATCH_FORCE_POLLING=true into the .bashrc file in your home directory.

If you would like finer control over the polling interval (to put it somewhere between the options of 5 seconds and 500 ms), set the METEOR_WATCH_POLLING_INTERVAL_MS environment variable to a number.


  • 2019-09-19 14:10:03

    Android UI布局优化之ViewStub介绍

    ViewStub的inflate只能被调用一次,第二次调用会抛出异常,setVisibility可以被调用多次,但不建议这么做(文章中说原因)

  • 2019-09-19 14:21:47

    Dubbo和spring cloud微服务框架区别和介绍

    关于 Dubbo 和 Spring Cloud 的相关概念和对比,上面已经叙述的很清楚了,我个人比较倾向于 Spring Cloud,原因就是真正的微服务框架、提供整套的组件支持、使用简单方便、强大的社区支持等等,另外,因为考虑到 .NET/.NET Core 的兼容处理,RPC 并不能很好的实现跨语言(需要借助跨语言库,比如 gRPC、Thrift,但因为 Dubbo 本身就是“gRPC”,在 Dubbo 之上再包一层 gRPC,有点重复封装了),而 HTTP REST 本身就是支持跨语言实现,所以,Spring Cloud 这一点还是非常好的(Dubbox 也支持,但性能相比要差一些)。

  • 2019-09-22 07:12:04

    git Please move or remove them before you can merge

    这是因为本地有修改,与云端别人提交的修改冲突,又没有merge. 如果确定使用云端的代码,最方便的解决方法是删除本地修改,可以使用以下命令: git clean -d -fx

  • 2019-09-22 07:36:52

    ALIN10146-自查方案

    报错原因 1.请求appid应用未上线或者是应用类型是第三方应用 2.签约权限问题 3.签名类型使用错误 4.请求参数问题 5.秘钥匹配问题 6.应用类型问题

  • 2019-09-22 07:37:44

    ALIN10146,ALI38173支付宝APP支付集成时出现的问题

    最近在做支付宝APP的集成,遇到了一堆问题。百度不到,ALI64还好点,ALI38173基本上就没了。我也是测试了很久才解决的。ALI64的解决方案是因为要对私钥有问题。ALI38173是签名有问题。签名的解决方...

  • 2019-09-22 22:32:20

    Spring Shiro 使用默认的Session会话管理

    项目中用到了shiro session会话管理机制,今天来总结一下,以下都是在spring boot框架实现。 shiro的session管理机制很完善,也是独立于j2ee容器且不依赖的,所以我们完全可以使用shiro提供给我们的session会话管理来实现我们的业务逻辑,默认提供的sessionDAO是memorySessionDAO,这里也主要讲它的配置和原理。 首先来看下如何在spring boot下配置默认的session会话管理: ShiroConfig类: