react-native icon indicating copy to clipboard operation
react-native copied to clipboard

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

Open gurkan-baykan opened this issue 4 months ago • 10 comments

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

gurkan-baykan avatar Aug 15 '25 09:08 gurkan-baykan

[!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.

react-native-bot avatar Aug 15 '25 09:08 react-native-bot

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

JatinDream11 avatar Aug 18 '25 12:08 JatinDream11

@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

gurkan-baykan avatar Aug 18 '25 12:08 gurkan-baykan

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 avatar Sep 24 '25 20:09 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

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

g-anwuli avatar Oct 11 '25 06:10 g-anwuli

@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!

uqmessias avatar Oct 15 '25 04:10 uqmessias

@uqmessias Thanks it worked.

g-anwuli avatar Oct 15 '25 14:10 g-anwuli

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?

nicolas-rohricht avatar Oct 17 '25 21:10 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?

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.

uqmessias avatar Oct 18 '25 02:10 uqmessias

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"

ashtrus avatar Dec 15 '25 08:12 ashtrus