React Native 错误:EMFILE:打开的文件太多,请注意

5 ios npm react-native

出现以下错误,而不是 100% 确定原因。当前在 ios 模拟器中运行我的应用程序时遇到此问题

我试过 npm install watchman,但我刚刚看到 npm 包的最新更新,它似乎已经贬值了。

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 
    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
}
Run Code Online (Sandbox Code Playgroud)

小智 5

这个错误是由守望者引起的。

您应该brew install watchman在终端中运行。

如果 watchman 安装失败,您应该通过以下方式将这些目录的所有权更改为您的用户

sudo chown -R $(whoami) /usr/local/etc/bash_completion.d /usr/local/lib/pkgconfig /usr/local/var/log
Run Code Online (Sandbox Code Playgroud)

请参阅终端中的提示。

最后你跑 brew install watchman。问题应该得到解决。