Getting this error while building a react-native iOS app on xcode.
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
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.What you can do to get it right is:
1)
npm uninstall reat-native-fs
to uninstall library2)
npm unlink react-native-fs
to unlink the libraryNow 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.
If
Libraries/React.xcodeproj
are red in xcode then reinstall node_modulesMy 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
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:
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:
Disable the parallel builds:
Add react as a project dependecy
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.