question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to load script. Make sure you're either running a Metro server (run 'react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.

See original GitHub issue

React Native version:

Steps To Reproduce

Describe what you expected to happen:

Snack, code example, screenshot, or link to a repository:

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:23 (1 by maintainers)

github_iconTop GitHub Comments

28reactions
alina-beckcommented, Aug 12, 2020

I have the same issue after upgrading from react-native 0.61.5 to 0.63.2.

  • Debug mode works fine, when running npx react-native run-android and yarn start in a separate terminal window.
  • Release build works fine, when running npx react-native run-android --variant=Release.
  • Staging build installs without problems but crashes after splash screen, when running npx react-native run-android --variant=Staging. When running from Android Studio it logs the ☝️ error:

Unable to load script. Make sure you’re either running a Metro server (run ‘react-native start’) or that your bundle ‘index.android.bundle’ is packaged correctly for release.

These are the buildTypes settings in my android/app/build.gradle (working fine for previous versions of react-native):

    buildTypes {
        debug {
            resValue "string", "CodePushDeploymentKey", '""'
        }
        staging {
            resValue "string", "CodePushDeploymentKey", '"******"'
            signingConfig signingConfigs.release
            matchingFallbacks = ['release']
        }
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            resValue "string", "CodePushDeploymentKey", '"******"'
            signingConfig signingConfigs.release
        }
    }

Please help! All the “solutions” I found so far were either suggesting to start a Metro Instance, or adding an assets folder (which already exists in my project), or running a three-lines-long bundle command – but surely there must be a better way!?

Update: Adding bundleInStaging: true to my app/build.gradle as suggested in this answer solved this problem for me! 🎉

25reactions
jihadrhamzacommented, Dec 8, 2019

I have solved the problem using the below steps.

  1. Updated nodejs to the latest version.
  2. Deleted the all the contents from .gradle(C:/Users/xxx/.gradle) folder (You may skip this in the initial attempt)
  3. I created project using,

    react-native init MyApp

  4. Move to the project folder.

    cd MyApp

  5. I was getting some blacklist.js some character issue. For that I referred this link and replaced sharedBlacklist character set. (https://stackoverflow.com/questions/58120990/how-to-resolve-the-error-on-react-native-start/58122821#58122821)
  6. Next, I ran the below code snippet to address the bundle issue.( Ref Link : https://medium.com/@adityasingh_32512/solved-unable-to-load-script-from-assets-index-android-bundle-bdc5e3a3d5ff)

    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

  7. react-native run-android Then, it started working. Hope this helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to load script.Make sure you are either running a ...
Make sure port 8081 isn't blocked. Also, make sure that you use one terminal to start the bundler, wait for it to finish...
Read more >
unable to load script make sure you are either ... - GitHub
To resolve try the following: 1. Clear watchman watches: `watchman watch-del-all`. 2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`. 3....
Read more >
React Native: Unable to load script: index. android.bundle
Make sure you 're either running a Metor service (run 'react-native start') or that your bundle 'index.android.bundle' is packaged correctly ...
Read more >
unable to load script make sure you are either ... - YouTube
unable o load script in react native solution || unable o load script in react native || unable to load script in react...
Read more >
unable to load script make sure you are either ... - YouTube
1.create directory android /app/src/main/assets2. run following command from project root directoryreact- native bundle --platform android ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found