`React/RCTBridgeModule.h` file not found

后端 未结 21 2112
执笔经年
执笔经年 2020-11-30 00:31

Getting this error while building a react-native iOS app on xcode.

Started getting this error after npm install and rpm linking react-native-fs library. But

相关标签:
21条回答
  • 2020-11-30 00:34

    In my case this particular problem happened when I was trying to archive a 0.40+ react-native app for iOS (solution was found here: Reliable build on ^0.39.2 fails when upgrading to ^0.40.0).

    What happened was that Xcode was trying to build the react-native libraries in parallel and was building libraries with implicit react dependencies before actually building the react library.

    The solution in my case was to:

    1. Disable the parallel builds:

      • Xcode menu -> Product -> Scheme -> Manage Shemes...
      • Double click on your application
      • Build tab -> uncheck Parallelize Build
    2. Add react as a project dependecy

      • Xcode Project Navigator -> drag React.xcodeproj from Libraries to root tree
      • Build Phases Tab -> Target Dependencies -> + -> add React
    0 讨论(0)
  • 2020-11-30 00:35

    Make sure you disable Parallelise Build and add React target above your target

    0 讨论(0)
  • 2020-11-30 00:35

    This error appeared for me after I ran pod install command for the new dependencies. Along with those, React had also been installed. Therefore probably Xcode was confused for path. I removed these lines from PodFile and error was gone. Please note that those removed from here were already linked in Xcode.

    target 'app' do
    
      pod 'GoogleMaps'
      pod 'Firebase/Auth', '~> 6.3.0'
      pod 'Firebase/Database', '~> 6.3.0'
    
      # Removed four pods below and it worked.
    
      pod 'react-native-image-picker', :path => '../node_modules/react-native-image-picker'
    
      pod 'ReactNativePermissions', :path => '../node_modules/react-native-permissions'
    
      pod 'react-native-image-resizer', :path => '../node_modules/react-native-image-resizer'
    
      pod 'RNFS', :path => '../node_modules/react-native-fs'
    
      end
    
    0 讨论(0)
  • 2020-11-30 00:35

    Go to iOS folder in your project and install pod -

    $ pod install
    

    If you are getting any error in installation of pod type command-

    $ xcode-select -p
    

    Result should be - /Applications/Xcode.app/Contents/Developer

    If the path is incorrect then open your iOS project in Xcode and go to: Xcode->preferences->command line tools-> select Xcode

    And again install the pod your issue will be fixed.

    0 讨论(0)
  • 2020-11-30 00:36

    If Libraries/React.xcodeproj are red in xcode then reinstall node_modules

    rm -rf node_modules && yarn
    

    My newly created project from react-native 0.46.3 was red :S I have npm 5.3.0 and yarn 0.24.5 when I did react-native init

    0 讨论(0)
  • 2020-11-30 00:37

    Change

      #import "RCTBridgeModule.h"
    

    to

     #import "React/RCTBridgeModule.h"
    
    0 讨论(0)
提交回复
热议问题