我try 使用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

推荐答案

对我来说,升级watchman没有帮助.

更新 node 后,此问题开始出现.js.

多亏了nvm,我回到了 node v8.11.3(我更新到v12.0.4),这个问题消失了.

这可能会帮助你们中的一些人有同样的问题...

React-native相关问答推荐

如何重复使用expo 音频对象S录音?

防止 React Native 在上下文值更改时重新安装组件

如何在底部标签导航中添加顶部标签

在 react native 平面列表中动态定位弹出窗口

React Native Axios 通过数组的键过滤

React-Native-Web 错误:rnw_blogpost.bundle.js:1414 Uncaught TypeError: Cannot read properties of undefined (reading 'isBatchingLegacy')

不能总是在 Chrome 中设置 React Native 断点

如何获取 iOS 版本?

在 create-react-native-app 元素中突然看到错误Plugin/Preset files are not allowed to export objects, only functions

用于部署后设置的 React 配置文件

使用 Hooks 在功能组件中react-navigation 标题

React-Native:显示加载屏幕直到加载 webview

将图标添加到drawer抽屉react-navigation v5

java.lang.UnsatisfiedLinkError:找不到要加载的 DSO:libfbjni.so 结果:0

opneUrl react-native 链接调用,mailto

在 OPTIONS 响应后使 fetch API 与 CORS 一起工作

使用 React Native 运行 Firebase 3.0 时出错

当前未启用语法nullishCoalescingOperator

react-native构建错误:package android.support.annotation does not exist

如何在react-native中验证 TextInput 值?