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-03-15 15:49:28

    win10远程桌面连接不上解决方法

    有朋友就感叹电脑的世界真的是很神奇,可以将整个世界连接在一起。如果别人想要摆弄你的电脑,即使不在一个地方也可以利用远程桌面来控制。而这就是所谓的远程控制操作了,大部分人都知道它的作用,不过这也不排除会遇到一些突发情况的时候,例如win10远程桌面连接不上,这该怎么去解决呢?为此,小编给大家带来了解决的图文操作。

  • 2019-03-15 16:49:18

    Win7无法进入家庭组提示“您的系统管理员不允许访问家庭组”怎么办

     家庭组是家庭网络上可以共享文件和打印机的一组计算机,可以方便用户们共享文件或者视频等,可是最近有win7纯净版系统用户却发现无法进入家庭组,提示“您的系统管理员不允许访问家庭组”,该怎么办呢?现在给大家分享一下Win7无法进入家庭组提示“您的系统管理员不允许访问家庭组”的解决方法。

  • 2019-03-17 22:19:28

    动态更新Toolbar Menu以及Menu中同时显示文字和图标

    我们经常会有这样的需求,在切换Fragment或者点击某个按钮后动态更新Toolbar上Menu项.但是onCreateOptionsMenu方法只在创建Activity的时候调用一次,以后就不再调用了,所以就不能在onCreateOptionsMenu中做处理了。 不过系统提供了另外的一个方法onPrepa

  • 2019-03-26 19:25:01

    Android studio 打包后安装闪退 Fatal Signal 6(SIGABRT)...

    项目上线前打包安装后闪退,查了很多原因,比如混淆文件的内容,第三方库不加入混淆等等,均未成功,后来关闭混淆打包后运行成功,原因可能是依赖工程中的库文件不能被混淆,关闭本工程混淆开关后,依赖工程的混淆开关也要关闭,关闭混淆后如果怕被反编译,可使用百度开发平台的app加固,加固的同时还能使用多渠道打包工具。

  • 2019-03-26 19:29:05

    Android NDK开发Crash错误定位

     在Android开发中,程序Crash分三种情况:未捕获的异常、ANR(Application Not Responding)和闪退(NDK引发错误)。其中未捕获的异常根据logcat打印的堆栈信息很容易定位错误。ANR错误也好查,Android规定,应用与用户进行交互时,如果5秒内没有响应用户的操作,则会引发ANR错误,并弹出一个系统提示框,让用户选择继续等待或立即关闭程序。并会在/data/anr目录下生成一个traces.txt文件,记录系统产生anr异常的堆栈和线程信息。如果是闪退,这问题比较难查, --------------------- 作者:xyang0917 来源:CSDN 原文:https://blog.csdn.net/xyang81/article/details/42319789 版权声明:本文为博主原创文章,转载请附上博文链接!

  • 2019-04-01 22:46:39

    电子签章的实施方案

    WORD/EXCEL签章模块,该部分实现与WORD/EXCEL的无缝结合,并提供给用户简单直观的菜单和工具条来实现文档签章验证等各种操作,其中,KHSC-64智能密码钥匙是签章模块中用户证书和图章的载体

  • 2019-04-01 22:48:25

    如何用 Java 对 PDF 文件进行电子签章

    印章是我国特有的历史文化产物,古代主要用作身份凭证和行驶职权的工具。它的起源是由于社会生活的实际需要。早在商周时代,印章就已经产生。如今的印章已成为一种独特的,融实用性和艺术性为一体的艺术瑰宝。传统的印章容易被坏人、小人私刻;从而新闻鲜有报道某某私刻公章,侵吞国家财产。随着计算机技术、加密技术及图像处理技术的发展,出现了电子签章。电子签章是电子签名的一种表现形式,利用图像处理技术、数字加密技术将电子签名操作转化为与纸质文件盖章操作相同的可视效果,同时利用电子签名技术保障电子信息的真实性和完整性以及签名人的不可否认性