sentry-react-native: Error building: 'React/RCTBridgeDelegate.h' file not found; 'React/RCTBridge.h' file not found
OS:
- Windows
- MacOS
- Linux
Platform:
- iOS
- Android
Output of node -v && npm -v && npm ls --prod --depth=0
v6.11.3
5.8.0
CTVistaPlus@0.0.1 /Users/fei/Documents/github/CtvpApp/CTVistaPlus
├── async-lock@1.1.0
├── promise-timeout@1.3.0
├── react@16.3.1
├── react-native@0.54.4
├── react-native-check-box@2.1.0
├── react-native-datepicker@1.6.0
├── react-native-fcm@10.0.3
├── react-native-gesture-handler@1.0.0-alpha.36
├── react-native-keyboard-aware-scroll-view@0.5.0
├── react-native-keychain@2.0.0
├── react-native-linear-gradient@2.4.0
├── react-native-modal@5.3.0
├── react-native-segmented-control-tab@3.2.1
├── react-native-sentry@0.35.3
├── react-native-simple-dialogs@0.3.1
├── react-native-tab-view@0.0.73
├── react-native-vector-icons@4.4.3
├── react-navigation@1.5.8
├── react-navigation-redux-helpers@1.0.3
├── react-redux@5.0.6
Config:
Sentry.config('https://...@sentry.io/...', {
....
}).install()
I have following issue: During ‘react-native run-ios’, my project can’t compile. Description goes here …
Steps to reproduce:
- Step
Actual result:
▸ Compiling RNSentry.m
❌ /node_modules/react-native/React/Base/RCTBridge.h:12:9: 'React/RCTBridgeDelegate.h' file not found
#import <React/RCTBridgeDelegate.h>
^
▸ Compiling RNSentryEventEmitter.m
❌ node_modules/react-native/React/Modules/RCTEventEmitter.h:10:9: 'React/RCTBridge.h' file not found
#import <React/RCTBridge.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~
** BUILD FAILED **
The following build commands failed:
CompileC ios/build/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SentryReactNative.build/Objects-normal/x86_64/RNSentryEventEmitter.o /node_modules/react-native-sentry/ios/RNSentryEventEmitter.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Expected result:
- Compiles ok
it’s strange that even when I have this error, my app runs in the simulater successfully.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 9
- Comments: 39 (5 by maintainers)
running
pod install
inside/ios
folder has worked perfectly for me! Thank you @najielchemalyFYI if you are still facing this issue after you successfully initialize a new project using react-native init, open Terminal, go to your project ios director, run pod install and then open the workspace project. It should build successfully.
Can you all do a
rm -rf node_modules
npm install
this should fix it. Actually this seems to be an ongoing issue with react-native itself https://github.com/facebook/react-native/issues/12042pod install
react-native run-ios
if error persists,
/ios
folder in x-code@macs03 that worked for me thanks! Was an issue from using Cocoapods and missing some steps.
Posting the comment here from @amsul:
Got it working!
For anyone reading this, these are the steps I took:
How does your Podfile look like?
Fix confirmed, with cocoapods 1.5.2
Hey, so I reverted the change,
React
is back in the podspec. Version0.37.0
is on its way, sorry for the inconvenience this has caused. I will close this issue now since this should solve it.I also have this issue after Cocoapods upgrade from 1.4.0 to 1.5.0 (so I downgraded it back to 1.4.0)
I’m hitting the same error, and that was after I upgraded cocoapods from 1.4.0 to 1.5.0. Solution: downgrade it. (as seen on: https://github.com/ocetnik/react-native-background-timer/issues/82#issuecomment-386583153)
Not sure if the culprit falls more on cocoapods messing up (deleting) HEADER_SEARCH_PATHS in
Sentry*.xcconfig
, or react-native-sentry not being better at said paths.Downgrading cocoapods works for me as a workaround, but obviously not a real fix moving forward.
here is what I did to fix this issue:
thank you very much, I finally got it working
Adding the following line to the
Podfile
in/ios
directory before runningpod install
solved the problem for me.@hccoelho You can change the Podspec file in ‘…/node_modules/react-native-onesignal’ and add react, I will try if adding a subspec can fix the problem in the podfile btw.
Maybe something like that could work in this case.
Hi, ^^ this is unfortunate. I tried to upgrade react native and now I’m kind of stuck because of this. @HazAT is removing React from dependency really necessary?
Try this => https://github.com/getsentry/react-native-sentry/issues/344#issuecomment-362354851