Skip to content

No Script URL provided.Make you sure the package manager is runnig or you have embedded a js bundler ı cannot to metro bundler in debug mode in real device ,it has problem 0.80.2d #53293

Open

Description

@gurkan-baykan

Description

I started experiencing this issue on my physical device. Even though I am in debug mode, my Metro device cannot connect to the network. Both are on the same Wi-Fi network, but they cannot establish a connection. I read the previous discussions, but no solution was found. this problem in code

 override func bundleURL() -> URL? {
#if DEBUG
    RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
    Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
  }
``` Please fix this.

![Image](https://github.com/user-attachments/assets/84cdcac1-1de5-4d92-a3f9-fe8ed09e912e)

### Steps to reproduce

https://github.com/facebook/react-native/issues

### React Native Version

0.80.2

### Affected Platforms

Runtime - iOS

### Output of `npx @react-native-community/cli info`

```text
System:
  OS: macOS 14.3.1
  CPU: (8) arm64 Apple M1 Pro
  Memory: 73.91 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.18.2
    path: ~/.nvm/versions/node/v18.18.2/bin/node
  Yarn:
    version: 3.6.4
    path: /usr/local/bin/yarn
  npm:
    version: 9.8.1
    path: ~/.nvm/versions/node/v18.18.2/bin/npm
  Watchman:
    version: 2024.01.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /Users/gurkanbaykan/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2021.3 AI-213.7172.25.2113.9123335
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.22
    path: /usr/bin/javac
  Ruby:
    version: 3.3.0
    path: /Users/gurkanbaykan/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 19.1.1
    wanted: 19.1.1
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.80.2
    wanted: 0.80.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

no script

MANDATORY Reproducer

https://github.com/facebook/react-native/issues

Screenshots and Videos

No Script URL provided.Make you sure the package manager is runnig or you have embedded a js bundler

Activity

  1. react-native-bot commented on Aug 15, 2025

    @react-native-bot
    Collaborator

    Warning

    Missing reproducer: We could not detect a reproducible example in your issue report. Reproducers are mandatory and we can accept only one of those as a valid reproducer:


    You can read more about about it on our website: How to report a bug.

  2. JatinDream11 commented on Aug 18, 2025

    @JatinDream11
    Contributor

    @gurkan-baykan Can you provide a valid Reproducer using our Reproducer Template

  3. gurkan-baykan commented on Aug 18, 2025

    @gurkan-baykan
    Author

    @gurkan-baykan Can you provide a valid Reproducer using our Reproducer Template

    Im solved my problem,you should uncheck for install builds only options , it is location Build Phases -> embed pods frameworks under

  4. gabemeola commented on Sep 24, 2025

    @gabemeola

    Unsure why but this broke after upgrading to 0.81.4.

    Simulator works fine, only physical device is broken.
    Looks like the issue is RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index") is return an empty URL on physical devices.

    Updating this line to the direct IP of the host is a workaround.

    class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
      override func sourceURL(for bridge: RCTBridge) -> URL? {
        self.bundleURL()
      }
    
      override func bundleURL() -> URL? {
    #if DEBUG
    //    return RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
        // Your host IP
        return URL(string: "http://192.168.1.180:8081/index.bundle?platform=ios&dev=true")
    #else
        Bundle.main.url(forResource: "main", withExtension: "jsbundle")
    #endif
      }
    }

    You'll also need to expose the build server on all net interfaces. react-native start --host 0.0.0.0

    Update

    In my case, the Build Phase "Bundle React Native code and images" was malformed. Fixing this solve the issue with debug and release builds

  5. g-anwuli commented on Oct 11, 2025

    @g-anwuli

    Unsure why but this broke after upgrading to 0.81.4.

    Simulator works fine, only physical device is broken. Looks like the issue is RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index") is return an empty URL on physical devices.

    Updating this line to the direct IP of the host is a workaround.

    class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
    override func sourceURL(for bridge: RCTBridge) -> URL? {
    self.bundleURL()
    }

    override func bundleURL() -> URL? {
    #if DEBUG
    // return RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
    // Your host IP
    return URL(string: "http://192.168.1.180:8081/index.bundle?platform=ios&dev=true")
    #else
    Bundle.main.url(forResource: "main", withExtension: "jsbundle")
    #endif
    }
    }
    You'll also need to expose the build server on all net interfaces. react-native start --host 0.0.0.0

    Update

    In my case, the Build Phase "Bundle React Native code and images" was malformed. Fixing this solve the issue with debug and release builds

    @gabemeola what did you eventually do in "Bundle React Native code and images" Build Phase to get it to work?

  6. uqmessias commented on Oct 15, 2025

    @uqmessias
    Contributor

    @g-anwuli, I had a similar issue, but it was happening because in my build phase, it was trying to run multiple commands using with-environment.sh script from React Native.

    What I did was to apply a fix from issue #54140, and it worked for me. I hope it works for you too!

  7. g-anwuli commented on Oct 15, 2025

    @g-anwuli

    @uqmessias Thanks it worked.

  8. nicolas-rohricht commented on Oct 17, 2025

    @nicolas-rohricht

    Hi @uqmessias @g-anwuli

    Just to make sure I'm doing the right thing...

    The exact thing you did was applying the davidliu's suggested change directly in the react-native node_modules's folder and applied a patch for it?

  9. uqmessias commented on Oct 18, 2025

    @uqmessias
    Contributor

    Hi @uqmessias @g-anwuli

    Just to make sure I'm doing the right thing...

    The exact thing you did was applying the davidliu's suggested change directly in the react-native node_modules's folder and applied a patch for it?

    Not exactly on the node_modules. What I'm doing is to apply these changes as a patch using yarn patch react-native, updating the necessary files, finishing the patch, and commiting the changes. You can do the same, but if you're using NPM, you can use patch-package instead.

  10. ashtrus commented on Dec 15, 2025

    @ashtrus

    I had the same error when upgraded to 0.81.5, could not build on device and also staging version of the app.

    What happened was, when I upgraded @sentry/react-native, had also to update React Native build phase to make it work on 0.81.1+. This change was not creating an ios bundle, so I was keep getting this error.

    Once I brought back the removed code and modified a script again, bundle was built and error disappeared.

    My updated code inside Bundle React Native code and images phase:

    set -e
    
    WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
    REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
    SENTRY_XCODE="../node_modules/@sentry/react-native/scripts/sentry-xcode.sh"
    
    # Bundle JavaScript first
    /bin/sh -c "$WITH_ENVIRONMENT $REACT_NATIVE_XCODE"
    
    # Then upload source maps to Sentry
    /bin/sh -c "$WITH_ENVIRONMENT $SENTRY_XCODE"
    
  11. grgmo commented on Jan 8, 2026

    @grgmo
    Contributor

    problem for me was after migrating to swift, bundleURL was not going into the DEBUG case

    #if DEBUG
        // NEEDS TO GO HERE
        RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
    #else
        // WENT HERE
        Bundle.main.url(forResource: "main", withExtension: "jsbundle")
    #endif
      }
    

    I would double check if it's hitting DEBUG case, if not this solution fixed it for me #49173 (comment)

  12. joartola commented on Apr 21, 2026

    @joartola

    Hitting this on RN 0.83.4 + New Architecture + Expo 55 + Objective-C AppDelegate. Both simulator and physical device affected.

    Diagnosis

    Added logging inside bundleURL to trace the resolution chain:

    - (NSURL *)bundleURL {
    #if DEBUG
      BOOL isRunning = [RCTBundleURLProvider isPackagerRunning:@"localhost"];
      NSString *hostPort = [[RCTBundleURLProvider sharedSettings] packagerServerHostPort];
      NSURL *url = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
      NSLog(@"isPackagerRunning=%@ hostPort='%@' url=%@",
            isRunning ? @"YES" : @"NO", hostPort ?: @"nil", url ?: @"nil");
      return url;
    #else
      ...
    #endif
    }

    Result:

    isPackagerRunning=YES hostPort='nil' url=nil
    

    Metro is reachable at localhost:8081 (200 OK), isPackagerRunning(localhost) returns YES, but packagerServerHostPort returns nil. This means guessPackagerHost inside packagerServerHostPort returns nil despite its individual pieces working correctly.

    After calling setJsLocation:@"localhost" explicitly, packagerServerHostPort returns "localhost" and bundleURL returns a valid URL.

    Workaround

    Two things were needed together:

    1. Add SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG" to the app target's Debug build config (as @TonyFTannous-Byd suggested — it was set project-level but missing on the target itself)

    2. Pre-set jsLocation before startReactNative in AppDelegate:

    #if DEBUG
    {
      NSString *ipPath = [[NSBundle mainBundle] pathForResource:@"ip" ofType:@"txt"];
      NSString *ip = [[NSString stringWithContentsOfFile:ipPath encoding:NSUTF8StringEncoding error:nil]
                      stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
      // Use ip.txt LAN IP for device builds, localhost for simulator/cloud-built dev clients
      BOOL isLanIp = [ip hasPrefix:@"192.168."] || [ip hasPrefix:@"10."];
      NSString *host = (ip.length > 0 && isLanIp) ? ip : @"localhost";
      [[RCTBundleURLProvider sharedSettings] setJsLocation:host];
    }
    #endif

    For us, the SWIFT flag alone wasn't sufficient — possibly because we have an Objective-C AppDelegate (not Swift). The setJsLocation bypass ensures packagerServerHostPort takes the jsLocation path and never hits the broken guessPackagerHost branch.

    Also required for physical devices: runOnlyForDeploymentPostprocessing = 0 on the "Bundle React Native code and images" build phase so ip.txt is generated in Debug builds (was set to 1, meaning it only ran during Archive).

    Environment

    • RN 0.83.4
    • Expo SDK 55
    • New Architecture enabled (RCT_NEW_ARCH_ENABLED=1)
    • Objective-C AppDelegate (inherited from older RN versions)
    • Xcode 16+
  13. react-native-bot commented on Oct 19, 2026

    @react-native-bot
    Collaborator

    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.

  14. added
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    and removed
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: AttentionIssues where the author has responded to feedback.Needs: ReproThis issue could be improved with a clear list of steps to reproduce the issue.📦Bundler

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions