Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

`React/RCTBridgeModule.h` file not found

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

like image 363
Simar Avatar asked Jan 15 '17 15:01

Simar


People also ask

How do I add react targets in Xcode?

Add new React to scheme In Xcode, select Product > Scheme > Edit Scheme On the left, Select Build Old React should be missing here, so delete it by clicking - button on the bottom. Add new React with + button, select it from Pods project Grab and move React to the top of the list.


2 Answers

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).

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
like image 158
agiaLab Avatar answered Sep 29 '22 03:09

agiaLab


Make sure you disable Parallelise Build and add React target above your target

enter image description here

like image 26
onmyway133 Avatar answered Sep 29 '22 03:09

onmyway133