facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.14k stars 24.32k forks source link

'React/RCTBridgeDelegate.h' file not found #30095

Closed ghost closed 1 year ago

ghost commented 4 years ago

Please provide all the information requested. Issues that do not follow this format are likely to stall.

Description

Please provide a clear and concise description of what the bug is. Include screenshots if needed. Please test using the latest React Native release to make sure your issue has not already been fixed: https://reactnative.dev/docs/upgrading.html

Building React Native app fails with the error that ''React/RCTBridgeDelegate.h' file not found'

React Native version:

System: OS: macOS 10.15.7 CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz Memory: 48.17 MB / 16.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 14.9.0 - /usr/local/bin/node Yarn: Not Found npm: 6.14.8 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.9.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0 Android SDK: API Levels: 28, 29, 30 Build Tools: 27.0.3, 28.0.3, 29.0.2, 30.0.2 System Images: android-19 | Google APIs Intel x86 Atom, android-23 | Google APIs ARM EABI v7a, android-23 | Google APIs Intel x86 Atom, android-24 | Google Play Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-29 | Intel x86 Atom_64, android-29 | Google Play Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: 4.0 AI-193.6911.18.40.6626763 Xcode: 12.0/12A7209 - /usr/bin/xcodebuild Languages: Java: 1.8.0_265 - /usr/bin/javac Python: 2.7.16 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: 0.63.2 => 0.63.2 npmGlobalPackages: react-native: Not Found

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

Here's my schema:

image image

I just run Build and I get this error:

image

Expected Results

Build not failing due to React/RCTBridgeDelegate.h being not found

Podfile:

require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '10.0'

target 'sameDesignTS' do

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

pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec" pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec" pod 'GoogleSignIn', '~> 5.0.2'

rn_maps_path = '../node_modules/react-native-maps' pod 'react-native-google-maps', :path => rn_maps_path pod 'GoogleMaps' pod 'Google-Maps-iOS-Utils' pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk'

config = use_native_modules! use_react_native!(:path => config["reactNativePath"])

target 'sameDesignTSTests' do inherit! :complete

Pods for testing

end

Enables Flipper.

#

Note that if you have use_frameworks! enabled, Flipper will not work and

you should disable these next few lines.

use_flipper! post_install do |installer| flipper_post_install(installer) end end

package.json:

{ "name": "sameDesignTS", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint . --ext .js,.jsx,.ts,.tsx", "clean:android": "cd android && ./gradlew clean && cd ../", "clean:ios": "cd ios && xcodebuild clean && cd ../" }, "dependencies": { "@react-native-community/async-storage": "^1.12.0", "@react-native-community/clipboard": "^1.2.3", "@react-native-community/geolocation": "^2.0.2", "@react-native-community/google-signin": "^4.0.3", "@react-native-community/masked-view": "^0.1.10", "@react-native-community/netinfo": "^5.9.6", "@react-native-community/push-notification-ios": "^1.5.0", "@react-native-firebase/app": "^8.4.1", "@react-native-firebase/messaging": "^7.8.4", "@react-navigation/bottom-tabs": "^5.8.0", "@react-navigation/native": "^5.7.3", "@react-navigation/stack": "^5.9.0", "@types/react-native-fbsdk": "^1.1.0", "@types/react-native-push-notification": "^5.0.2", "@types/react-native-vector-icons": "^6.4.5", "@types/react-native-version-check": "^3.4.0", "@types/react-redux": "^7.1.9", "apisauce": "^1.1.2", "axios": "^0.20.0", "formik": "^2.1.5", "lodash": "^4.17.20", "lottie-ios": "^3.1.8", "lottie-react-native": "^3.5.0", "react": "16.13.1", "react-native": "0.63.2", "react-native-background-fetch": "^3.1.0", "react-native-device-info": "^6.0.2", "react-native-elements": "^2.3.2", "react-native-fbsdk": "^2.0.0", "react-native-geolocation-service": "^5.0.0", "react-native-gesture-handler": "^1.8.0", "react-native-linear-gradient": "^2.5.6", "react-native-map-link": "^2.7.17", "react-native-maps": "0.27.1", "react-native-maps-directions": "^1.8.0", "react-native-modalize": "^2.0.6", "react-native-permissions": "^2.2.0", "react-native-push-notification": "^5.1.1", "react-native-rate": "^1.2.4", "react-native-reanimated": "^1.13.0", "react-native-safe-area-context": "^3.1.7", "react-native-screens": "^2.10.1", "react-native-simple-dialogs": "^1.3.0", "react-native-splash-screen": "^3.2.0", "react-native-svg": "^12.1.0", "react-native-swiper": "^1.6.0", "react-native-vector-icons": "^7.0.0", "react-native-version-check": "^3.4.1", "react-redux": "^7.2.1", "redux": "^4.0.5", "redux-persist": "^6.0.0", "redux-thunk": "^2.3.0", "yup": "^0.29.3" }, "devDependencies": { "@babel/core": "^7.8.4", "@babel/runtime": "^7.8.4", "@react-native-community/eslint-config": "^1.1.0", "@types/jest": "^25.2.3", "@types/lodash": "^4.14.161", "@types/react-native": "^0.63.2", "@types/react-test-renderer": "^16.9.2", "@types/yup": "^0.29.6", "@typescript-eslint/eslint-plugin": "^2.27.0", "@typescript-eslint/parser": "^2.27.0", "babel-jest": "^25.1.0", "eslint": "^6.5.1", "faker": "^5.1.0", "jest": "^25.1.0", "metro-react-native-babel-preset": "^0.59.0", "prettier": "^2.0.4", "react-test-renderer": "16.13.1", "reactotron-react-native": "^5.0.0", "reactotron-redux": "^3.1.3", "typescript": "^3.8.3" }, "jest": { "preset": "react-native", "moduleFileExtensions": [ "ts", "tsx", "js", "jsx", "json", "node" ] } }

Anzormumladze commented 4 years ago

run pod install inside /ios folder and clean build folder command+shift+k inside xcode

1280103995 commented 4 years ago

Same here! 1) react-native init demo 2) cd ios && pod install && cd .. (error:[!] Pods written in Swift can only be integrated as frameworks; add `use_frameworks!` to your Podfile or target to opt into using it. The Swift Pod being used is: YogaKit) 3) yarn ios (error: fatal error: 'React/RCTBridgeDelegate.h' file not found)

"dependencies": {
    "react": "16.13.1",
    "react-native": "0.63.3"
  }
System:
    OS: macOS 10.15.7
    CPU: (8) x64 Intel(R) Core(TM) i3-10100 CPU @ 3.60GHz
    Memory: 149.03 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.16.3 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.9.0 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.4.0 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0
    Android SDK:
      API Levels: 23, 25, 26, 27, 28, 29
      Build Tools: 27.0.3, 28.0.3, 29.0.2
      Android NDK: 20.0.5594570
  IDEs:
    Android Studio: 4.0 AI-193.6911.18.40.6626763
    Xcode: 12.0.1/12A7300 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_162 - /Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.3 => 0.63.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
dekuvjs commented 3 years ago

I got the same problem, only happens when building a release or archive, but debug runs normally

luism3861 commented 3 years ago

Try the following:

1.- Clean (cmd+shift+K) 2.- Build core React - select React as the scheme in Xcode and build it (cmd+B) 3.- Build your app.

rmaharba commented 3 years ago

Try the following:

1.- Clean (cmd+shift+K) 2.- Build core React - select React as the scheme in Xcode and build it (cmd+B) 3.- Build your app.

Don't work

dekuvjs commented 3 years ago

Try the following:

1.- Clean (cmd+shift+K) 2.- Build core React - select React as the scheme in Xcode and build it (cmd+B) 3.- Build your app.

Does not work

luism3861 commented 3 years ago

@Darkiring @dekuvjs after build in React scheme you need return app name and then clean again and run the app or if this not works. Build the library that is failing (e.g.RCTBridgeDelegate). other options delete node_modules, ios/Pods and then install pod install clean project and run.

luism3861 commented 3 years ago

image image

luism3861 commented 3 years ago

last option manage schemes select react, select react and then run command + b , return you app base clean project and build project.

rmaharba commented 3 years ago

last option manage schemes select react, select react and then run command + b , return you app base clean project and build project.

That's don't work man :(

luism3861 commented 3 years ago

last option manage schemes select react, select react and then run command + b , return you app base clean project and build project.

That's don't work man :(

@Darkiring be sure delete app in simulator, delete node_modules, clean cache project

rmaharba commented 3 years ago

@luism3861 The app works fine in debug mode, the problem its when we try to run archive with xcode to send to testflight.

rmaharba commented 3 years ago

@luism3861 Hi Luis, error solved, the version of the Podfile did not match the version we had selected in Xcode, the podfile had version 11.0 and xcode had version 10 selected. When we changed it in Xcode immediately the error did not appear anymore, a lot of thanks!

olalerephillip commented 3 years ago

i'm also having this issue and i have been on it for days. please if you have solved this in any way please help me out. thanks

dekuvjs commented 3 years ago

@olalerephillip yeah, I know is frustrating. Try what @Darkiring said. 1-go to xcode and select your project 2- then click your proyect name. 3- click your project name under the tag"PROJECT" not "TARGETS", 4- and under "develpment Target" change the option "iOS Development Target" to your podfile ios version. 5- run "pod deintegrate" && "pod install".

Hope it works.

FrozenPyrozen commented 3 years ago

If you are running mac os on m1 chip, this answer can help with it https://stackoverflow.com/a/68543052/11792060 , works for me)

VivekKotiya commented 3 years ago

hi you checked with pod install ? if you pod install is not done correctly due to some version or repo mismatch this issue will come for that you just need to "pod repo update" then "pod install" and at first time instead of running app from xcode, try with terminal with "npx react-native run-ios"

Ghoral commented 3 years ago

@luism3861 Hi Luis, error solved, the version of the Podfile did not match the version we had selected in Xcode, the podfile had version 11.0 and xcode had version 10 selected. When we changed it in Xcode immediately the error did not appear anymore, a lot of thanks!

Thanks, man..It took almost a week to solve.

rmaharba commented 2 years ago

@luism3861 Hi Luis, error solved, the version of the Podfile did not match the version we had selected in Xcode, the podfile had version 11.0 and xcode had version 10 selected. When we changed it in Xcode immediately the error did not appear anymore, a lot of thanks!

Thanks, man..It took almost a week to solve.

You're welcome!

FreTimmerman commented 2 years ago

i too am having this issue. i've done this

1.- Clean (cmd+shift+K) 2.- Build core React - select React as the scheme in Xcode and build it (cmd+B) 3.- Build your app.

and this

last option manage schemes select react, select react and then run command + b , return you app base clean project and build project.

and this

1-go to xcode and select your project 2- then click your proyect name. 3- click your project name under the tag"PROJECT" not "TARGETS", 4- and under "develpment Target" change the option "iOS Development Target" to your podfile ios version. 5- run "pod deintegrate" && "pod install".

in every possible combination i'm running on m1 mac, am i supposed to perform pod install or arch -x86_64 pod install or does that not matter anymore? (in any case i've also tried all of the above with both kinds of pod install but no luck)

i keep getting error

AppDelegate.h:1:9: 'React/RCTBridgeDelegate.h' file not found

when performing archive. building and running works okay on my physical phone.

archive does work when i select the Debug build configuration, but i get the error when it's on the Release build configuration

System:
    OS: macOS 12.0.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 112.73 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 17.2.0 - /opt/homebrew/bin/node
    Yarn: 1.22.17 - /opt/homebrew/bin/yarn
    npm: 8.1.4 - /opt/homebrew/bin/npm
    Watchman: 2021.12.06.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.0.1, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0
    Android SDK:
      API Levels: 28, 29, 30, 31
      Build Tools: 30.0.2, 31.0.0
      System Images: android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom_64, android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom_64, android-29 | Google Play ARM 64 v8a, android-30 | ARM 64 v8a, android-30 | Google APIs ARM 64 v8a, android-30 | Google Play ARM 64 v8a, android-31 | Google Play ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2020.3 AI-203.7717.56.2031.7784292
    Xcode: 13.1/13A1030d - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_292 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: ^0.66.1 => 0.66.1 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

edit: it seems to have been solved by removing some duplicate entries in Build settings->Search paths-> Header search paths

sixhellstations commented 2 years ago

In case you have Macbook with an M1 you should run: sudo arch -x86_64 gem install ffi

Then, from the ios directory: arch -x86_64 pod install

MultidimensionalLife commented 2 years ago

any updates for this issue? I'm having the same problem. Thanks

olalerephillip commented 2 years ago

Hi guys. for me to fix this issue, i did some few things like: I first removed pod using this command: rm '/usr/local/bin/pod' I then installed again using: brew install cocoapods

To force the link and overwrite all conflicting files, i did below:

brew link --overwrite cocoapods

after the above steps,

execute the command below

xcode-select -p

That should print Applications/Xcode.app/Contents/Developer

if your selected version is different from the one showed by the command above, you should switch your active dev directory by running the below command.

sudo xcode-select -s <your code application path as displayed by the command above>

with those steps you should be fine. If there are any errors, do not hesitate to let me know.

Regards

Phillips

On Thu, Feb 3, 2022 at 8:12 AM Chester Paul Danao @.***> wrote:

any updates for this issue? I'm having the same problem. Thanks

— Reply to this email directly, view it on GitHub https://github.com/facebook/react-native/issues/30095#issuecomment-1028671173, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR34N6GGYY2ORUYLPF66KG3UZITENANCNFSM4SBT4CHQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

KitaniIslam commented 2 years ago

First run:

$ brew install cocoapods

then make sure to close all Terminal instances by clicking (Command + Q). try again:

$ pod install
TunvirRahman commented 2 years ago
System:
    OS: macOS 11.6.4
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Memory: 274.05 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.0 - /usr/local/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.5.1 - /usr/local/bin/npm
    Watchman: 2022.03.07.00 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
  IDEs:
    Android Studio: 2020.3 AI-203.7717.56.2031.7621141
    Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.2 => 0.61.2 
  npmGlobalPackages:
    react-native-cli: 2.0.1

Tried all approach but no luck. Anyone have solved this in the above config?

TunvirRahman commented 2 years ago

i'm also having this issue and i have been on it for days. please if you have solved this in any way please help me out. thanks

Same Here. Killing by time and energy. have you found any solution?

sujeongy commented 2 years ago

In case you have Macbook with an M1 you should run: sudo arch -x86_64 gem install ffi

Then, from the ios directory: arch -x86_64 pod install

thanks. you save my life 😀

ramseena commented 2 years ago

I got the same problem, only happens when building a release or archive, but debug runs normally

did you got any solution?

ramseena commented 2 years ago

iOS development or deployment target?

samuelhulla commented 2 years ago

This is now fixed with the new release of react-native: 0.69.4 and now works correctly on also M1 arm64 architecture.

JDerf commented 2 years ago

@luism3861 Hi Luis, error solved, the version of the Podfile did not match the version we had selected in Xcode, the podfile had version 11.0 and xcode had version 10 selected. When we changed it in Xcode immediately the error did not appear anymore, a lot of thanks!

Could someone please walk through the steps to do this?

woliwa1 commented 1 year ago

I tried all of the above methods and kept prompting this error when the emulator was running. react-native: 0.69.4 mac: M1 pro How can it work properly?

boyphongsakorn commented 1 year ago

I tried all of the above methods and kept prompting this error when the emulator was running. react-native: 0.69.4 mac: M1 pro How can it work properly?

yeah i have a same thing how to make that work?

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 7 days with no activity.

dangnguyen1004 commented 1 year ago

Did anyone solve this issue?

dangnguyen1004 commented 1 year ago

None of these work for me 😭

karthikeyancontus commented 10 months ago

None of these work for me 😭

dangnguyen1004 commented 10 months ago

Hi @karthikeyancontus, you can try this one: https://gamedevtodied.blogspot.com/2020/05/react-native-xcode-reactrctbridgedelega.html?sc=1697689644311#c7308020809858258651

karthikeyancontus commented 10 months ago

thanks @dangnguyen1004, I just # use_flipper!() commented on this line and ran it, it's worked for me