Skip to content

No script URL provided. Make sure the packager is running or you have embedded a JS bundle in your application bundle. #49173

Closed

Description

@TonyFTannous-Byd

Description

i upgrade my react native app from 0.76.6 to 0.77.0. The build has successfully but i have the following error

No script URL provided. Make sure the packager is running or you have embedded a JS bundle in your application bundle.

unsanitizedScriptURLString = (null)

Steps to reproduce

i applied all the step mention
https://react-native-community.github.io/upgrade-helper/?from=0.76.6&to=0.77.0&package=com.idp.com&name=IDPMobile

  • npm install
  • cd ios
  • pod deintegrate pod install --repo-update
  • cd ios && xcodebuild clean
  • npx react-native run-ios

React Native Version

0.77.0

Affected Platforms

Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 14.5
  CPU: (8) arm64 Apple M1
  Memory: 111.05 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.18.1
    path: ~/.nvm/versions/node/v20.18.1/bin/node
  Yarn: Not Found
  npm:
    version: 10.9.2
    path: ~/Documents/AccuV-Team/IDP.Mobile/node_modules/.bin/npm
  Watchman:
    version: 2024.01.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/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:
    API Levels:
      - "28"
      - "29"
      - "31"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 33.0.2
      - 33.0.3
      - 34.0.0
      - 35.0.0
    System Images:
      - android-31 | Google APIs ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
      - android-35 | Google APIs ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23339.11.2421.12700392
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.77.0
    wanted: ^0.77.0
  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 URL provided. Make sure the packager is running or you have embedded a JS bundle in your application bundle.

unsanitizedScriptURLString = (null)

Reproducer

https://github.com/TonyFTannous-Byd/repo

open the terminal and run the following:

1- npm run start:clean
2- npm run android:local (it work no problem)
3- npm run ios:local (ios platform did not work, and i have the error in the Screenshots bellow)
...

Screenshots and Videos

Image

Activity

  1. jeroenburgers commented on Feb 17, 2025

    @jeroenburgers

    You are a hero @OTitaev!

  2. TonyFTannous-Byd commented on Feb 17, 2025

    @TonyFTannous-Byd
    Author

    good job @OTitaev 👍

  3. TonyFTannous-Byd commented on Feb 21, 2025

    @TonyFTannous-Byd
    Author

    @OTitaev
    our Cocoapods scripts should inject that flag for you: https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L422

    the react_native_post_install function called in your post_install hook as shown here: https://github.com/react-native-community/template/blob/main/template/ios/Podfile#L28-L33

    why SWIFT_ACTIVE_COMPILATION_CONDITIONS not injected????

  4. wuduwawawei commented on Feb 27, 2025

    @wuduwawawei

    #49245 (comment)
    Try this and I hope it can help you.

  5. ouyangzhigang commented on Apr 2, 2025

    @ouyangzhigang

    Facing same problem

  6. ashishAmz commented on Apr 3, 2025

    @ashishAmz

    I am also facing same issue,

  7. rym903 commented on Apr 4, 2025

    @rym903

    I'm also facing same issue

  8. rym903 commented on Apr 4, 2025

    @rym903

    Guys, the problem is in DEBUG flag in AppDelegate.swift

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

    You should add SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";

    Inside project.pbxproj in debug XCBuildConfiguration block

    Should look like this

    83CBBA201A601CBA00E9B192 /* Debug */ = {
    			isa = XCBuildConfiguration;
    			buildSettings = {
    				ALWAYS_SEARCH_USER_PATHS = NO;
    				CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
    				CLANG_CXX_LANGUAGE_STANDARD = "c++20";
    				CLANG_CXX_LIBRARY = "libc++";
    				CLANG_ENABLE_MODULES = YES;
    				CLANG_ENABLE_OBJC_ARC = YES;
    				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
    				CLANG_WARN_BOOL_CONVERSION = YES;
    				CLANG_WARN_COMMA = YES;
    				CLANG_WARN_CONSTANT_CONVERSION = YES;
    				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
    				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
    				CLANG_WARN_EMPTY_BODY = YES;
    				CLANG_WARN_ENUM_CONVERSION = YES;
    				CLANG_WARN_INFINITE_RECURSION = YES;
    				CLANG_WARN_INT_CONVERSION = YES;
    				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
    				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
    				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
    				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
    				CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
    				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
    				CLANG_WARN_STRICT_PROTOTYPES = YES;
    				CLANG_WARN_SUSPICIOUS_MOVE = YES;
    				CLANG_WARN_UNREACHABLE_CODE = YES;
    				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
    				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
    				COPY_PHASE_STRIP = NO;
    				ENABLE_STRICT_OBJC_MSGSEND = YES;
    				ENABLE_TESTABILITY = YES;
    				"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
    				GCC_C_LANGUAGE_STANDARD = gnu99;
    				GCC_DYNAMIC_NO_PIC = NO;
    				GCC_NO_COMMON_BLOCKS = YES;
    				GCC_OPTIMIZATION_LEVEL = 0;
    				GCC_PREPROCESSOR_DEFINITIONS = (
    					"DEBUG=1",
    					"$(inherited)",
    				);
    				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
    				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
    				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
    				GCC_WARN_UNDECLARED_SELECTOR = YES;
    				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
    				GCC_WARN_UNUSED_FUNCTION = YES;
    				GCC_WARN_UNUSED_VARIABLE = YES;
    				IPHONEOS_DEPLOYMENT_TARGET = 15.1;
    				LD_RUNPATH_SEARCH_PATHS = (
    					/usr/lib/swift,
    					"$(inherited)",
    				);
    				LIBRARY_SEARCH_PATHS = (
    					"\"$(SDKROOT)/usr/lib/swift\"",
    					"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
    					"\"$(inherited)\"",
    				);
    				MTL_ENABLE_DEBUG_INFO = YES;
    				ONLY_ACTIVE_ARCH = YES;
    				OTHER_CPLUSPLUSFLAGS = (
    					"$(OTHER_CFLAGS)",
    					"-DFOLLY_NO_CONFIG",
    					"-DFOLLY_MOBILE=1",
    					"-DFOLLY_USE_LIBCPP=1",
    					"-DFOLLY_CFG_NO_COROUTINES=1",
    					"-DFOLLY_HAVE_CLOCK_GETTIME=1",
    				);
    				OTHER_LDFLAGS = (
    					"$(inherited)",
    					" ",
    				);
    				REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
    				SDKROOT = iphoneos;
    				SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
    				USE_HERMES = true;
    			};
    			name = Debug;
    		};
    

    I tried this but
    SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG"; is already inside my project.pbxproj..

  9. matinzd commented on Apr 16, 2025

    @matinzd
    Contributor

    SWIFT_ACTIVE_COMPILATION_CONDITIONS is not being set for the main project. It's being set for pods project. You'll also need to add it for the main project:

    	SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
    
  10. jsSteud commented on Apr 17, 2025

    @jsSteud

    For me the problem was solved, when I had both (computer and iPhone) in the same WIFI. Only connected with a cable didn't work, but within the same WIFI worked.

  11. gfgafn commented on Apr 22, 2025

    @gfgafn

    Check your network proxy settings, you will get this error when the following three conditions are met at the same time

    • You are using the iOS simulator
    • You have enabled the network proxy in the Mac OS System Settings
    • The network proxy server is not on the same device as the Metro Dev Server

    This causes the request from your react native APP to http://localhost:8081 not be forwarded to the Metro Dev Server by the proxy server.

    The simplest solution
    Turn off the network proxy in Mac OS System Settings, completely exit your react native APP and reopen it
    add localhost to Bypass proxy settings for these hosts & domains:

  12. redbluenat commented on Apr 23, 2025

    @redbluenat

    I had the same problem, and I already had the SWIFT_ACTIVE_COMPILATION_CONDITIONS flag set. Here's what helped me:

    Remove Pods

    Remove node_modules

    Do a fresh install

    After installing the app, go to Settings and enable Local Network access

  13. daraxdray commented on May 13, 2025

    @daraxdray

    I had the same problem, and I already had the SWIFT_ACTIVE_COMPILATION_CONDITIONS flag set. Here's what helped me:

    Remove Pods

    Remove node_modules

    Do a fresh install

    After installing the app, go to Settings and enable Local Network access

    Fresh install of all the node modules and pod?
    ANd where in the settings are we going to enable Local Network access?

  14. ascebiswajit commented on May 14, 2025

    @ascebiswajit

    if u facing this issue , and tries everything then tried it once

    Uncheck the "For install builds only" option in Bundle React Native code and images phase.

    This will ensure the script runs on every build (including debug builds from Xcode).

    Image

    if u have that doubt Why U uncheck It read below

    When running the app from Xcode to a real device:

    By default, Metro runs at localhost:8081 on your Mac, but the device cannot resolve localhost to your Mac IP.

    Additionally, in Xcode Build Phases → "Bundle React Native code and images", the option "For install builds only" is often checked by default.

    This causes the bundling script to only run for install builds, not for normal debug builds.

    Resulting in the device trying to connect to Metro but failing because the app doesn't know the correct Metro server IP.

  15. Imran0511 commented on Jun 2, 2025

    @Imran0511

    Do one thing
    If you are building the app via XCode leave that and build it using terminal
    like for example do yarn ios --device(if you are using yarn) , you can select your iphone there
    It will make a new build and hopefully it'll run

    Also you can check if your metro was running earlier. Close that and build again.

  16. Chwajid007 commented on Jun 23, 2025

    @Chwajid007

    Delete the node modules and pods then reinstall it.

    Works for me.

  17. genesisbell commented on Jul 24, 2025

    @genesisbell

    My problem was that I had scheme names other than DEBUG. What I needed to do was to Add -DDEBUG to all my Debug-Like Schemes. Steps:

    1. Open Xcode → Project Navigator → Select your app target

    2. Go to Build Settings

    • Filter by: Other Swift Flags
    • Or navigate to:
      Swift Compiler – Custom Flags > Other Swift Flags
    1. Add -DDEBUG to all relevant configurations
      For example:
    Configuration Flags
    devDebug -DDEBUG ✅
    prodDebug -DDEBUG ✅
    stagDebug -DDEBUG ✅
    devRelease (leave empty) ❌
    prodRelease (leave empty) ❌
    stagRelease (leave empty) ❌

    You only need -DDEBUG for the debug builds — never add it to Release.

    ✅ After Adding:

    1. Product > Clean Build Folder
    2. Restart Metro:
      npx react-native start --reset-cache
  18. sandy-garrido commented on Aug 27, 2025

    @sandy-garrido

    For me the issue was simply that the testing device and the developer mac were on restricted networks (the need to be able to talk to each other via the network). I set up a hotspot for both devices (Dev Mac & test iPhone) and now it works.

  19. Super1Windcloud commented on Sep 14, 2025

    @Super1Windcloud

    It's so easy ,
    First method , xcode config Allow access to the local network
    Second method , iphone open settings to set app permission for allow access to local network

  20. ShadyElsharnoby commented on Sep 15, 2025

    @ShadyElsharnoby
  21. ShadyElsharnoby commented on Sep 15, 2025

    @ShadyElsharnoby

    Steps to Reproduce
    upgrade react native to latest 0.81.4
    and add new scripts like Sentry DOC

    `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_REACT_NATIVE="/bin/sh $SENTRY_XCODE $REACT_NATIVE_XCODE"

    Expected Result
    when run on real device this should work normal like simulator but i faced this error

    No script URL provided. Make sure the packager is running or you have embedded a JS bundle in your application bundle. unsanitizedScriptURLString = (null)

    in case i revert the script every thing work good without sentry

    Actual Result
    No script URL provided. Make sure the packager is running or you have embedded a JS bundle in your application bundle. unsanitizedScriptURLString = (null)

  22. antinucleus commented on Sep 17, 2025

    @antinucleus

    If a local server (e.g., Express or Fastify) is started on the same port as Expo (8081), this error will occur. In my case, the issue was resolved by stopping the local server or configuring it to use a different port.

  23. Donybro commented on Sep 24, 2025

    @Donybro

    I did prev steps SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG"; then deleted ios,android,expo, node-modules folders then do npm install, npx expo prebuild --clean and npx expo run:ios --device but still see issue, then I changed my backend base url in .env file from http://localhost:8080 to http://172.16.13.4:8080 (you can get your own with ipconfig getifaddr en0) and it is worked for me

  24. UlasRenasOrdu commented on Oct 15, 2025

    @UlasRenasOrdu

    npm install --> npx expo run:ios

    worked for me.

  25. justsomeofl commented on Jan 25, 2026

    @justsomeofl

    Add this to AppDelegate.swift before startReactNative

        #if DEBUG
          RCTBundleURLProvider.sharedSettings().jsLocation = "192.168.1.20:8081" // IP of your computer
        #endif
    
    
  26. ericTrayt commented on Apr 15, 2026

    @ericTrayt

    Why is this closed, still seems to be an issue for many people and none of the above answers have worked for me.

  27. 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+
  28. wubaibin commented on Sep 9, 2026

    @wubaibin

    First, run "yarn start", and then run "yarn ios".

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