【问题标题】:How to exclude node_modules from watchers files如何从观察者文件中排除 node_modules
【发布时间】:2020-09-24 12:17:46
【问题描述】:

当我执行ng serve 时,日志显示如下错误:

Error from chokidar (/PATH_OF_MY_PROJECT/node_modules/ionicons/dist/ionicons/svg): Error: ENOSPC: System limit for number of file watchers reached, watch '/PATH_OF_MY_PROJECT/node_modules/ionicons/dist/ionicons/svg/ios-subway.svg'

我了解到解决方案是更改 Linux 上的 watchers 文件,但这是一个糟糕的解决方案!

为什么 Angular 需要查看对 node_modules 的更改?这是一个不会改变的文件夹。如果我需要安装新库,我可以重新启动服务器。

如果您的解决方案是:请不要回答我: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf。我不想使用这种糟糕的解决方案。

【问题讨论】:

  • OP,您找到问题的解决方案了吗?

标签: angular-cli watch chokidar angular-devkit


【解决方案1】:

我遇到了同样的问题,每个答案都指向了你所说的解决方案。

如果您的解决方案是,则不回答我:echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf

这对我也没有帮助。 我找不到解决方案,但是在 webpack 中,您可以忽略/排除您不想检查的目录,只是在 module.exports 中执行下一个操作:

module.exports = {
      target: 'node',
      ...
      watchOptions: {
        ignored: [
          /node_modules/,
          ...
        ],
      },

【讨论】:

    猜你喜欢
    • 2017-02-13
    • 1970-01-01
    • 1970-01-01
    • 2010-10-11
    • 2012-01-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多