Ami*_*mir 31 react-native react-native-ios
我尝试使用 react-native start 运行 react-native-cli 项目,但是 Metro bundler 失败了,说如下:
events.js 187
throw er; //Unhandled 'error' event
Error: EMFILE: too many open files, watch
Emitted 'error' event on NodeWatcher isntance at:
at NodeWatcher: checkedEmitError (.../react-native-project/node_modules/sane/src/node_watcher.js:143:12)
at FSWatcher.emit (events.js:210:5)
at FSEvent.FSWatcher:_handle onchange (internal/fs/watchers.js:129:12) {
errno: -24,
syscall: 'watch',
code : 'EMFILE',
filename: null
)
Process terminated. Press <enter> to close the window
Run Code Online (Sandbox Code Playgroud)
Rom*_*mar 56
只需关闭所有其他文件并重试。如果您在 android 上运行cd android
,请确保./gradlew clean
在react-native run-android
. 如果这不能解决问题,则您的文件监视服务可能存在问题。尝试这个
$ brew update
$ brew install watchman
Run Code Online (Sandbox Code Playgroud)
Żab*_*jad 22
就我而言,升级守望者并没有帮助。
更新 Node.js 后开始出现此问题。
感谢nvm
,我回到节点 v8.11.3(我更新到 v12.0.4)并且这个问题消失了。
这可能会帮助你们中的一些人遇到同样的问题......
小智 18
我正在使用 Mac 并收到 EMFile 错误。当我安装文件观察器时它已解决
brew install watchman
Osc*_*car 16
我需要像其他人在这里所做的那样watchman
安装,但是我还需要使用以下行更新:以便 xCode 可以在我的 M1 MacBook Pro 中找到。brew
React Native Xcode build script
export PATH=/opt/homebrew/bin:$PATH
watchman
React Native Xcode 构建脚本位置:./node_modules/react-native/scripts/react-native-xcode.sh
升级我的节点版本后我遇到了这个问题。在我的情况下,降级不是一种选择。
brew install watchman
没有解决这个问题,因为 watchman 已经安装在我的机器上。brew upgrade watchman
帮我解决了这个问题。
小智 9
TLTR:brew install watchman
在 Macbook 上解决了这个问题。
我刚买了一台新 Macbook,在 React Native 项目中遇到了同样的问题。在 Windows 上,该项目运行良好,但在 Mac 上,使用 npm start 运行该项目几秒钟后,它崩溃并出现以下错误:
Error: EMFILE: too many open files, watch
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:178:28)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ start: `expo start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Run Code Online (Sandbox Code Playgroud)
PS:npm install
没用。它必须与brew install
.
小智 6
无论我做什么,我都无法让它发挥作用。最终对我有用的是使用以下命令
$ sudo sysctl -w kern.maxfiles=10485760
$ sudo sysctl -w kern.maxfilesperproc=1048576
Run Code Online (Sandbox Code Playgroud)
位于: https: //facebook.github.io/watchman/docs/install.html#mac-os-file-descriptor-limits
我有一台 M1 Pro。希望这对某人有帮助。
归档时间: |
|
查看次数: |
26348 次 |
最近记录: |