React-native: 'React/RCTDefines.h' file not found from RCTWebSocketExecutor.h with React-Core

Created on 8 Oct 2019  ·  12Comments  ·  Source: facebook/react-native

I upgraded react-native to version 0.61.2, and did rm -rf Pods, rm -rf Podfile.lock and then pod install, then open xcode with myproject.xcworkspace, click build button, I got:
'React/RCTDefines.h' file not found, my Header Search Paths is set as $(inherited) recursive, also I went to Manage Schemes ->myproject target -> Build, I unchecked Parallelize Build and I have React as my first Target before myproject.

Screen Shot 2019-10-07 at 11 14 11 PM

React Native version:
System:
OS: macOS Mojave 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Memory: 42.34 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 11.4.0 - /usr/local/bin/node
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.1, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
Android SDK:
API Levels: 23, 25, 26, 27, 28
Build Tools: 27.0.3, 28.0.2, 28.0.3
System Images: android-22 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.1 AI-173.4907809
Xcode: 11.1/11A1027 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.2 => 0.61.2
npmGlobalPackages:
react-native-asset: 2.0.0
react-native-cli: 2.0.1
react-native-cn-richtext-editor: 1.0.33
react-native-git-upgrade: 0.2.7

Steps To Reproduce

  1. Use the following podfile,
  2. rm -rf Pods, rm -rf Podfile.lock
  3. pod install
  4. open xcode
  5. Product -> Clean for build folder
  6. Click build button
  7. Check for errors with React-Core: 'React/RCTDefines.h' file not found

Describe what you expected to happen:
Should build successfully.

Podfile: got it by referring this link:
https://react-native-community.github.io/upgrade-helper/?from=0.59.8&to=0.61.2

platform :ios, '9.1'

#source 'https://cdn.cocoapods.org/'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target 'myproject' do

#use_frameworks!

# Pods for myproject
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/'
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 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'
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'

permissions_path = '../node_modules/react-native-permissions/ios'

pod 'Permission-BluetoothPeripheral', :path => "#{permissions_path}/BluetoothPeripheral.podspec"
pod 'Permission-Calendars', :path => "#{permissions_path}/Calendars.podspec"
pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts.podspec"
pod 'Permission-FaceID', :path => "#{permissions_path}/FaceID.podspec"
pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec"
pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary.podspec"
pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone.podspec"
pod 'Permission-Motion', :path => "#{permissions_path}/Motion.podspec"
pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications.podspec"
pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"
pod 'Permission-Reminders', :path => "#{permissions_path}/Reminders.podspec"
pod 'Permission-SpeechRecognition', :path => "#{permissions_path}/SpeechRecognition.podspec"
pod 'Permission-StoreKit', :path => "#{permissions_path}/StoreKit.podspec"

pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob'

pod 'react-native-camera', :path => '../node_modules/react-native-camera'

use_native_modules!

end

Bug Stale

Most helpful comment

I had this same issue, I went into /node_modules/react-native/React/Base/RCTBridgeModule.h and changed #import <React/RCTDefines.h> into

#if __has_include("RCTDefines.h")
  #import "RCTDefines.h"
#else
 #import <React/RCTDefines.h>
#endif

I used patch-package to patch.

All 12 comments

I had this same issue, I went into /node_modules/react-native/React/Base/RCTBridgeModule.h and changed #import <React/RCTDefines.h> into

#if __has_include("RCTDefines.h")
  #import "RCTDefines.h"
#else
 #import <React/RCTDefines.h>
#endif

I used patch-package to patch.

Hi jeffmon, thanks for your response, I am using react-native 0.61.2, the most recent version, there is no /node_modules/react-native/React folder, the new version is all pod, there is a React.podspec as attached picture shown, so what to do? thanks again for your help.
Screen Shot 2019-10-08 at 11 17 36 AM

Screen Shot 2019-10-08 at 5 28 45 AM
Screen Shot 2019-10-08 at 5 28 03 AM

I'm using RN 0.61.2 as well, here is what my node_modules/react-native folder looks like. Try rm -rf node_modules and yarn install again.

Thanks for your help, after I rerun npm install for react-native, I got the React subfolder, now it passed the React-Core build, but I got another issue with react-native-svg:
'React/RCTImageLoader.h' file not found:

Screen Shot 2019-10-08 at 3 15 07 PM

I have RN 0.61.2 and "react-native-svg": "^9.11.1"
I did fresh pod install with react-native-svg pod, also It was mentioned here that RCTImageLoader.h is removed from RCTImage:
https://github.com/pilot4u/react-native-fs/pull/1/commits/05097bcfd8877a195d1a3734ac1565aa13fea19f

So what is the solution?

My System:
System:
OS: macOS Mojave 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Memory: 436.19 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 11.4.0 - /usr/local/bin/node
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.1, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
Android SDK:
API Levels: 23, 25, 26, 27, 28
Build Tools: 27.0.3, 28.0.2, 28.0.3
System Images: android-22 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.1 AI-173.4907809
Xcode: 11.1/11A1027 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.2 => 0.61.2
npmGlobalPackages:
react-native-asset: 2.0.0
react-native-cli: 2.0.1
react-native-cn-richtext-editor: 1.0.33
react-native-git-upgrade: 0.2.7

Sorry for the late response, but you might have to run a similar if/else block in RNSVGImage.m.

im having the same issue but only on other build scheme than the original one. it cannot find many @idoor88 did you manage to solve it somehow ?

btw i also have react native 0.61.2

I found a solution for this problem, see here https://github.com/joltup/rn-fetch-blob/issues/461#issuecomment-553355501

I haven't upgraded RN, currently have a version 0.61.5. I installed the package using npm and added pods. And I am getting mentioned error while trying to create the build, should I go through manual linking steps at all or not? @infostreams I have tried your solution in the comment and I got this
Screen Shot 2020-03-28 at 12 44 14 PM

@judygab No idea. I had this issue 5 months ago, spent a day cursing at it until I fixed it as described, and then didn't look back 😬 Sorry! And good luck.

fwiw, this issue bubbled up to me when I manually linked a package that didn't contain a podspec. Maybe useful here? 🤷‍♂️

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

Was this page helpful?
0 / 5 - 0 ratings