错误 "User limit of inotify watches reached"。 ExtReact 构建

Error "User limit of inotify watches reached". ExtReact build

我安装了ExtReact,有例子。当我运行

npm start

我收到一个错误:

ERROR in [@extjs/reactor-webpack-plugin]: Error:
[ERR] BUILD FAILED
[ERR] com.sencha.exceptions.BasicException: User limit of inotify watches 
reached
[ERR]
[ERR] Total time: 13 seconds

[ERR] /home/user/project/build/ext-react/build.xml:101: 
com.sencha.exceptions.BasicException: User limit of inotify watches reached
[ERR] A log is available in the file "/home/user/project/build/ext-
react/sencha-error-20171027.log"

如何解决这个错误?

我通过编辑 /etc/sysctl.conf 解决了这个问题。到我添加的文件

fs.inotify.max_user_watches=100000

为什么?

同步文件的程序,如 dropbox、git 等,使用 inotify 来通知文件系统的更改。可以通过-

查看限制
cat /proc/sys/fs/inotify/max_user_watches

对我来说,它显示 100000。当此限制不足以监视目录中的所有文件时,它会抛出此错误。


增加inotify watchers的数量(精简版):

如果您 运行正在 Debian、RedHat 或其他类似的 Linux 发行版,运行 在终端中执行以下操作:

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

如果您 运行ning ArchLinux,运行 则使用以下命令(请参阅此处了解原因):

echo fs.inotify.max_user_watches=524288 | sudo tee /etc/sysctl.d/40-max-user-watches.conf && sudo sysctl --system

然后将其粘贴到您的终端并按回车键 运行 它。


技术细节:

Listen 默认在 Linux 上使用 inotify 来监视目录的变化。系统对您可以监控的文件数量进行限制的情况并不少见。例如,Ubuntu Lucid 的(64 位)inotify 限制设置为 8192。

您可以通过执行以下命令获取当前的 inotify 文件监视限制:

$ cat /proc/sys/fs/inotify/max_user_watches

当此限制不足以监控目录中的所有文件时,必须增加限制才能使 Listen 正常工作。

您可以设置一个临时的新限制:

$ sudo sysctl fs.inotify.max_user_watches=524288
$ sudo sysctl -p

如果您想永久限制,请使用:

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

如果Listen老是报错,可能还需要注意max_queued_events和max_user_instances的值

来源:https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers

增加观看次数

  • cat /proc/sys/fs/inotify/max_user_watches

  • sudo vim /etc/sysctl.conf

  • 将此行添加到文件末尾:

    fs.inotify.max_user_watches=524288
    
  • sudo sysctl -p

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

否则访问 https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers

在 Linux 铸币厂, 运行 这个命令,你可以开始了

echo fs.inotify.max_user_watches=524288 | sudo tee /etc/sysctl.d/40-max-user-watches.conf && sudo sysctl --system