SECURITY WARNING: Never run commands you don't understand. Always review code before execution. Use at your own risk.
Mobile New Added 10 September 2026

React Native: Unable to load script. Make sure you're running Metro

The debug build fetches its JavaScript bundle from Metro at runtime, and the device could not reach it. On a physical Android device localhost means the phone itself, so the port has to be forwarded over adb; on a release build the message instead means the bundle was never packaged into the app.

Quick fix

Read the commands before running them. Anything that restarts a service, deletes data or changes permissions should be tried on a non-production system first.

Quick fix
# Metro has to be running, on the port the app expects
npx react-native start --port 8081

# Physical Android device: forward the port to the phone
adb reverse tcp:8081 tcp:8081
adb devices          # the device must be listed as "device", not "unauthorized"

# Emulator uses 10.0.2.2 for the host; Genymotion uses 10.0.3.2
# Shake the device -> Dev Settings -> Debug server host: 192.168.1.20:8081

# Stale cache after a dependency change
watchman watch-del-all
npx react-native start --reset-cache

# Release build with no bundle: generate it
npx react-native bundle --platform android --dev false \
  --entry-file index.js \
  --bundle-output android/app/src/main/assets/index.android.bundle \
  --assets-dest android/app/src/main/res

How to diagnose Mobile errors

Mobile build errors are overwhelmingly toolchain and dependency version conflicts rather than code problems. Android builds fail on Gradle, JDK and Android Gradle Plugin version combinations; iOS builds fail on code signing, provisioning profiles and CocoaPods lockfile drift. The productive instinct is to check version compatibility matrices before reading stack traces.

If the quick fix above does not resolve it, work through these steps. They apply to this whole class of error, not just to this one message, which is usually what saves the time.

  1. Run the build with full output: ./gradlew assembleDebug --stacktrace --info. Gradle's default output hides the actual failing task.
  2. Verify the JDK the build is using (./gradlew -version), not the one on your PATH. Android Gradle Plugin has strict JDK requirements.
  3. For CocoaPods, run pod install, not pod update, after pulling changes, and open the .xcworkspace rather than the .xcodeproj.
  4. For code signing, check the provisioning profile's expiry, bundle identifier and device list in Xcode's Signing & Capabilities tab before touching certificates.
  5. Clear caches only as a last resort and one at a time (./gradlew clean, rm -rf ~/Library/Developer/Xcode/DerivedData, watchman watch-del-all), so you learn which one mattered.

Tools worth reaching for

  • ./gradlew --stacktrace --info
  • pod install
  • xcodebuild -showBuildSettings
  • flutter doctor -v
  • adb logcat

Authoritative references

Primary documentation for this error, worth reading before applying any fix in production.

reactnative.dev

Related Mobile errors

See all 17 Mobile errors →

Browse other categories

Something missing or wrong?

This entry is maintained by hand. If the fix is out of date, incomplete, or you have a better one, email a correction and it will be reviewed.