节点events.js:292 throw er; //未处理的“错误”事件

时间:2020-08-23 20:30:53

标签: node.js json reactjs

我正在尝试使用以下命令捆绑我的ios构建:

react-native bundle --dev false --entry-file index.js --bundle-output ios/main.jsbundle --platform ios

但是每次我尝试得到此错误:

events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:127:28)
Emitted 'error' event on NodeWatcher instance at:
    at NodeWatcher.checkedEmitError (/usr/local/lib/node_modules/react-native/node_modules/sane/src/node_watcher.js:143:12)
    at FSWatcher.emit (events.js:315:20)
    at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:133:12) {
  errno: -24,
  syscall: 'watch',
  code: 'EMFILE',
  filename: null
}

我尝试了以下操作:killnode命令,安装监视程序,重新启动计算机,删除node_modules文件夹和npm安装。到目前为止,任何方法都没有起作用,并且错误不断显示。

1 个答案:

答案 0 :(得分:0)

可能只是您需要提高打开文件的限制。

尝试使用ulimit 4096并查看其工作原理?

这样,您就可以解决此问题,而不是解决根本原因。

可能只是您的系统配置太低,无法进行实际的标准反应构建过程,并且没有错。

您也可以,尽管也不建议设置无限限制。

ulimit unlimited。如果这样做,建议通过-S标志:ulimit -S unlimited设置软限制,以免超出内存。