未找到 `React/RCTBridgeModule.h` 文件 [英] `React/RCTBridgeModule.h` file not found
问题描述
在 xcode 上构建 react-native iOS 应用时出现此错误.
Getting this error while building a react-native iOS app on xcode.
在 npm install 和 rpm 链接 react-native-fs 库后开始出现此错误.但是在网上搜索解决方案后,我发现很多人在安装其他 react native 库时都遇到了同样的错误.
Started getting this error after npm install and rpm linking react-native-fs library. But after searching online for a solution, I noticed that many people are getting the same error while installing other react native libraries.
许多人建议的可能的解决方案是,在Build Settings"->Header Search Paths"下添加以下内容.
A possible solution suggested by many is, Adding the following under "Build Settings" -> "Header Search Paths".
$(SRCROOT)/../node_modules/react-native/React
- (递归)
但是这个解决方案不走运,仍然出现同样的错误
But no luck with this solution, still getting the same error
推荐答案
就我而言,当我尝试为 iOS 归档 0.40+ react-native 应用程序时发生了这个特殊问题(解决方案在这里找到:在升级到 ^ 时,
).^0.39.2
上的可靠构建失败0.40.0
In my case this particular problem happened when I was trying to archive a 0.40+ react-native app for iOS (solution was found here: Reliable build on ^0.39.2
fails when upgrading to ^0.40.0
).
发生的事情是 Xcode 试图并行构建 react-native 库,并且在实际上之前构建了具有隐式 react 依赖项的库构建反应库.
What happened was that Xcode was trying to build the react-native libraries in parallel and was building libraries with implicit react dependencies before actually building the react library.
我的解决方案是:
禁用并行构建:
Disable the parallel builds:
- Xcode 菜单 -> Product -> Scheme -> Manage Shemes...
- 双击您的应用程序
- 构建选项卡 -> 取消选中并行构建
添加 react 作为项目依赖
Add react as a project dependecy
- Xcode Project Navigator -> 将 React.xcodeproj 从库中拖到根树
- 构建阶段选项卡 -> 目标依赖项 -> + -> 添加 React
这篇关于未找到 `React/RCTBridgeModule.h` 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!