`React/RCTBridgeModule.h` file not found

2019-01-16 14:10发布

Getting this error while building a react-native iOS app on xcode.

enter image description here

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.

A possible solution suggested by many is, Adding the following under "Build Settings" -> "Header Search Paths".

$(SRCROOT)/../node_modules/react-native/React - (Recursive)

But no luck with this solution, still getting the same error

9条回答
闹够了就滚
2楼-- · 2019-01-16 14:19

For viewers who got this error after upgrading React Native to 0.40+, you may need to run react-native upgrade on the command line.

查看更多
Root(大扎)
3楼-- · 2019-01-16 14:22

What you can do to get it right is:

1) npm uninstall reat-native-fs to uninstall library

2)npm unlink react-native-fs to unlink the library

Now the library is successfully removed and now install the lib again in your project and this time link everything manually. Sometime automatic linking causes this error.

查看更多
叼着烟拽天下
4楼-- · 2019-01-16 14:28

If Libraries/React.xcodeproj are red in xcode then reinstall node_modules

rm -rf node_modules && yarn

My newly created project from react-native 0.46.3 was red :S I have npm 5.3.0 and yarn 0.24.5 when I did react-native init

查看更多
再贱就再见
5楼-- · 2019-01-16 14:30

Latest releases of react-native libraries as explained in previous posts and here have breaking compatibility changes. If you do not plan to upgrade to react-native 0.40+ yet you can force install previous version of the library, for example with react-native-fs:

npm install --save -E react-native-fs@1.5.1
查看更多
beautiful°
6楼-- · 2019-01-16 14:36

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: https://github.com/facebook/react-native/issues/11721#issuecomment-270672904).

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.

The solution in my case was to:

  1. Disable the parallel builds:

    • Xcode menu -> Product -> Scheme -> Manage Shemes...
    • Double click on your application
    • Build tab -> uncheck Parallelize Build
  2. Add react as a project dependecy

    • Xcode Project Navigator -> drag React.xcodeproj from Libraries to root tree
    • Build Phases Tab -> Target Dependencies -> + -> add React
查看更多
相关推荐>>
7楼-- · 2019-01-16 14:40

I was able to build a debug, but I was unable to build an archive.

I solved this issue by dragging React.xcodeproj found in /node_modules/react-native/React to my root directory in Xcode, then added React as a target dependancy in build phases > target dependencies.

查看更多
登录 后发表回答