“RCTBundleURLProvider.h” file not found - AppDelegate.m

后端 未结 26 1344
遇见更好的自我
遇见更好的自我 2020-12-04 06:29

I am trying to run my React Native app in XCode and I keep getting this error. I cannot figure out how to resolve the issue. Any suggestions?

Screen Shot of Error in

相关标签:
26条回答
  • 2020-12-04 07:02

    The solution that works for me is to share React scheme.

    If you don't have React scheme, create new one by Selecting scheme menu -> Manage Scheme -> + -> choose React, then mark React scheme as Shared

    Also, if you use Xcode 10, go to File -> Project Settings and select Legacy build system

    0 讨论(0)
  • 2020-12-04 07:03

    For my case, I couldn't delete node_modules and re-install and I also couldn't do react-native-git-updgrade or react-native upgrade because I wanted to stay on RN-0.59 because .60 causes problems for my dependencies.

    Anyway my situation was that I was missing 'React/RCTBundleURLProvider.h' file. I already had React available in my schemas. It was not in my libraries directory. I checked my target's build settings.

    Inside target dependencies, I also had React in there.

    I deleted 'React' target dependency, then re-added. cleaned build folders, re-built project. it worked.

    0 讨论(0)
  • 2020-12-04 07:04

    In the base dir of the project I run:

    node_modules/react-native/packager/packager.sh --reset-cache

    Which resulted in:

    Scanning 554 folders for symlinks in /Users/..../work/..../react_tutorial/AwesomeProject/node_modules (15ms)
     ┌────────────────────────────────────────────────────────────────────────────┐
     │  Running packager on port 8081.                                            │
     │                                                                            │
     │  Keep this packager running while developing on any JS projects. Feel      │
     │  free to close this tab and run your own packager instance if you          │
     │  prefer.                                                                   │
     │                                                                            │
     │  https://github.com/facebook/react-native                                  │
     │                                                                            │
     └────────────────────────────────────────────────────────────────────────────┘
    Looking for JS files in
       /Users/..../work/...../react_tutorial/AwesomeProject
    
    Loading dependency graph... ERROR  Packager can't listen on port 8081
    Most likely another process is already using this port
    Run the following command to find out which process:
    
    lsof -i :8081
    

    I found that package manager can't run when another packager process is running.

    I found the process running with:

    lsof -i :8081

    Than I kill 9 ... the process.

    After than I closed Xcode, run:

    npm install

    And started Xcode again, from this moment everything work as expected!!

    0 讨论(0)
  • 2020-12-04 07:05

    I faced same issue .then i have deleted node .try to use these steps

    1. Delete the node_modules folder - rm -rf node_modules && npm install
    2. Reset packager cache - rm -fr $TMPDIR/react-* or node_modules/react-native/packager/packager.sh --reset-cache
    3. Clear watchman watches - watchman watch-del-all

    then make build and see

    0 讨论(0)
  • 2020-12-04 07:06

    None of the other suggestions were fixing my error but this one did it.

    1 - Create Podfile

    Create a file named ios/Podfile inside your react-native app with the following contents:

    # You Podfile should look similar to this file. React Native currently does not support use_frameworks!
    source 'https://github.com/CocoaPods/Specs.git'
    
    platform :ios, '8.0'
    
    target '<YOUR_APP_NAME>' do
      # Fixes required for pod specs to work with rn 0.42
      react_native_path = "../node_modules/react-native"
      pod "Yoga", :path => "#{react_native_path}/ReactCommon/yoga"
      pod "React", :path => react_native_path, :subspecs => [
        'Core',
        'RCTActionSheet',
        'RCTAnimation',
        'RCTGeolocation',
        'RCTImage',
        'RCTLinkingIOS',
        'RCTNetwork',
        'RCTSettings',
        'RCTText',
        'RCTVibration',
        'RCTWebSocket'
      ]
    
      pod 'GoogleMaps'  # <~~ remove this line if you do not want to support GoogleMaps on iOS
    
    # when not using frameworks  we can do this instead of including the source files in our project (1/4):
    #  pod 'react-native-maps', path: '../../'
    #  pod 'react-native-google-maps', path: '../../'  # <~~ if you need GoogleMaps support on iOS
    end
    

    2 - Install Podfile

    Run the command pod install from inside the ios folder.

    3 - Reset XCode

    Restart XCode and the error should be gone.

    0 讨论(0)
  • 2020-12-04 07:06

    You might be running .xcodeproj file after pod is installed.

    Close it and open .xcworkspace file. It worked for me.

    0 讨论(0)
提交回复
热议问题