angular-cli - 如何从观察者文件中排除 node_modules

标签 angular-cli watch chokidar angular-devkit

当我这样做时 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 上更改观察者文件,但这是一个糟糕的解决方案!
为什么 Angular 需要查看 node_modules 的变化?这是一个不会改变的文件夹。如果我需要安装一个新库,我可以重新启动服务器。
如果您的解决方案是:echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf .我不想使用这个糟糕的解决方案。

最佳答案

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

Doesnt answer me if your solution is: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf


这也没有帮助我。
我找不到解决方案,但是在 webpack 中,您可以忽略/排除您不想检查的目录,只需在 module.exports 中执行以下操作即可:
module.exports = {
      target: 'node',
      ...
      watchOptions: {
        ignored: [
          /node_modules/,
          ...
        ],
      },

关于angular-cli - 如何从观察者文件中排除 node_modules,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62212835/

相关文章:

angular - 如何在 Angular 6 中通过 `ng serve` 设置环境

javascript - VueJS : watching two properties

javascript - AngularJS 指令 - 链接函数元素参数在监视函数中不可用

reactjs - 重新安装 np 后 chokidar 出现错误,

reactjs - fsevents@2.3.2 安装问题的平台不受支持

angular-cli - 如何使用 Angular-Cli 在不在/src/app 的文件夹中创建组件

javascript - Angular 4 - 即使在手动安装 portfinder 后,我仍然无法找到模块 'portfinder'

reactjs - 如何在没有 Webpack 的情况下使用 Babel

javascript - TypeError : path. 连接不是函数

Angular 2 子路由