react-native: 'react/bridging/LongLivedObject.h' file not found And Could not build module 'ReactCommon'

Description

<Project path>/Pods/Headers/Public/ReactCommon/ReactCommon/LongLivedObject.h:11:10 ‘react/bridging/LongLivedObject.h’ file not found

<Project path>/Pods/Headers/Public/React-Core/React/RCTAppSetupUtils.h:30:9 Could not build module ‘ReactCommon’

Screenshot 2022-12-16 at 6 52 48 PM

Version

0.70.6

Output of npx react-native info

System: OS: macOS 13.0.1 CPU: (8) x64 Apple M1 Pro Memory: 11.91 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 19.2.0 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 8.19.3 - /usr/local/bin/npm Watchman: 2022.11.28.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8609683 Xcode: 14.1/14B47b - /usr/bin/xcodebuild Languages: Java: Not Found npmPackages: @react-native-community/cli: Not Found react: 18.1.0 => 18.1.0 react-native: ^0.70.6 => 0.70.6 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

Integrated RN version 0.70.6 to existing ios apps Installed pod vial this command RCT_NEW_ARCH_ENABLED=1 fabric_enabled=1 arch -x86_64 pod install

Snack, code example, screenshot, or link to a repository

Screenshot 2022-12-16 at 6 52 48 PM

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 5
  • Comments: 22 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Hi there, I’m sorry for this problem.

Can anyone provide a repro I can try on my own?

It’s not the first time we see such issues. Our CI has tests for both the Old and the New Architecture, to make sure that it builds, so it should be some edge case that we are not handling properly.

For context:

Now, my gut feeling is that there is something in your configuration that changes the HEADER_SEARCH_PATH of React Native and makes it lose the reference to the ReactCommon base path.

But to verify this, I’ll need to reproduce it on a small sample.

Here is the patch-package for react-native 0.71.3 :

create patches/react-native+0.71.3.patch and add "postinstall": "patch-package"in your package.json.

diff --git a/node_modules/react-native/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.cpp b/node_modules/react-native/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.cpp
index 03c65ef..b41b29d 100644
--- a/node_modules/react-native/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.cpp
+++ b/node_modules/react-native/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.cpp
@@ -10,7 +10,7 @@
 #include <stdexcept>
 #include <string>
 
-#include <ReactCommon/LongLivedObject.h>
+#include <react/bridging/LongLivedObject.h>
 #include <cxxreact/SystraceSection.h>
 
 using namespace facebook;
diff --git a/node_modules/react-native/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.h b/node_modules/react-native/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.h
index 1791d4e..ed4184a 100644
--- a/node_modules/react-native/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.h
+++ b/node_modules/react-native/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.h
@@ -9,7 +9,7 @@
 
 #include <string>
 
-#include <ReactCommon/LongLivedObject.h>
+#include <react/bridging/LongLivedObject.h>
 #include <ReactCommon/TurboModule.h>
 #include <jsi/jsi.h>
 
diff --git a/node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModule.mm b/node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModule.mm
index 1ee5908..8aab28f 100644
--- a/node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModule.mm
+++ b/node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModule.mm
@@ -22,7 +22,7 @@
 #import <React/RCTModuleMethod.h>
 #import <React/RCTUtils.h>
 #import <ReactCommon/CallInvoker.h>
-#import <ReactCommon/LongLivedObject.h>
+#import <react/bridging/LongLivedObject.h>
 #import <ReactCommon/TurboModule.h>
 #import <ReactCommon/TurboModulePerfLogger.h>
 #import <ReactCommon/TurboModuleUtils.h>

EXJSIUtils

Are you using Expo? Or just some libraries from Expo but the main flow is handled by the RN CLI?