[ios] Can't build new rn project after running 'pod install' with RNBG dependency
react-native-background-geolocation/ios/RNBackgroundGeolocation/RNBackgroundGeolocation.h:14:9: fatal error: 'React/RCTEventEmitter.h' file not found
Your Environment
- Plugin version: 3.4.2
- Platform: iOS
- Device manufacturer / model: iPhone X (simulator)
- React Native version (
react-native -v): 0.61.5
Expected Behavior
Actual Behavior
Project won't build with the error given above.
Steps to Reproduce
- Start brand new rn project
- pod install
- build is successful
- add RNBG and RNBF to project and link
- pod install
- build fails with error: react-native-background-geolocation/ios/RNBackgroundGeolocation/RNBackgroundGeolocation.h:14:9: fatal error: 'React/RCTEventEmitter.h' file not found
Debug logs
react-native-background-geolocation/ios/RNBackgroundGeolocation/RNBackgroundGeolocation.h:14:9: fatal error: 'React/RCTEventEmitter.h' file not found
Logs
Here's my Podfile
platform :ios, '10.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target 'h2hMobileApp' do
# Pods for h2hMobileApp
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
pod 'React', :path => '../node_modules/react-native/', :modular_headers => true
pod 'React-Core', :path => '../node_modules/react-native/'
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
pod 'react-native-mapbox-gl', :path => '../node_modules/@react-native-mapbox-gl/maps'
pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'
pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'
pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
pod 'react-native-viewpager', :path => '../node_modules/@react-native-community/viewpager'
pod 'react-native-camera', :path => '../node_modules/react-native-camera'
pod 'RNAudioRecorderPlayer', :path => '../node_modules/react-native-audio-recorder-player'
pod 'react-native-keep-awake', :path => '../node_modules/react-native-keep-awake'
pod 'react-native-splash-screen', :path => '../node_modules/react-native-splash-screen'
pod 'react-native-print', :path => '../node_modules/react-native-print'
pod 'RNBackgroundFetch', :path => '../node_modules/react-native-background-fetch'
pod 'RNBackgroundGeolocation', :path => '../node_modules/react-native-background-geolocation'
pod 'RNSoundPlayer', :path => '../node_modules/react-native-sound-player'
pod 'ReactNativeAudioToolkit', :path => '../node_modules/@react-native-community/audio-toolkit'
target 'h2hMobileAppTests' do
inherit! :search_paths
# Pods for testing
end
use_native_modules!
end
target 'h2hMobileApp-tvOS' do
# Pods for h2hMobileApp-tvOS
target 'h2hMobileApp-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
RN > 0.60 uses auto-linking. You're not supposed to manually add modules to your Podfile. Remove all these:
pod 'react-native-mapbox-gl', :path => '../node_modules/@react-native-mapbox-gl/maps'
pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'
pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'
pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
pod 'react-native-viewpager', :path => '../node_modules/@react-native-community/viewpager'
pod 'react-native-camera', :path => '../node_modules/react-native-camera'
pod 'RNAudioRecorderPlayer', :path => '../node_modules/react-native-audio-recorder-player'
pod 'react-native-keep-awake', :path => '../node_modules/react-native-keep-awake'
pod 'react-native-splash-screen', :path => '../node_modules/react-native-splash-screen'
pod 'react-native-print', :path => '../node_modules/react-native-print'
pod 'RNBackgroundFetch', :path => '../node_modules/react-native-background-fetch'
pod 'RNBackgroundGeolocation', :path => '../node_modules/react-native-background-geolocation'
pod 'RNSoundPlayer', :path => '../node_modules/react-native-sound-player'
pod 'ReactNativeAudioToolkit', :path => '../node_modules/@react-native-community/audio-toolkit'
This one-line automatically auto-links all your 3rd party dependencies.:
use_native_modules!
See the SampleApp Podfile
And of course, after adding the plugin:
$ cd ios
$ pod install
Thank you so much. Always appreciate the help.