Unable to load script.Make sure you are either running a Metro server or that your bundle 'index.android.bundle' is packaged correctly for release

后端 未结 30 1885
你的背包
你的背包 2020-11-28 19:16

react-native run-android command terminates by leaving a message in android simulator. The message is as follows:

Unable to load script.Make

相关标签:
30条回答
  • 2020-11-28 19:41

    In my case, I've set a proxy in my emulator. It works back to normal after I removing that proxy.

    0 讨论(0)
  • 2020-11-28 19:45

    You haven't started the bundler yet. Run npm start or react-native start in the root directory of your project before react-native run-android.

    0 讨论(0)
  • 2020-11-28 19:45

    After hours searching for a answer. The solution was to make a downgrade node to version 12.4.

    In my case I realize that the error just occurs in version react native 0.60 with node version 12.6.

    0 讨论(0)
  • 2020-11-28 19:45

    I've encountered the same issue while following the React Native tutorial (developing on Linux and targeting Android).

    This issue helped me resolve the problem in following steps. Run following commands in the below sequence:

    1. (in project directory) mkdir android/app/src/main/assets
    2. 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
    3. react-native run-android

    You can automate the above steps by placing them in scripts part of package.json like this:

    "android-linux": "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 && react-native run-android"
    

    Then you can just execute npm run android-linux from your command line every time.

    0 讨论(0)
  • 2020-11-28 19:46

    just add three splash in : node_modules\metro-config\src\defaults\blacklist.js

    replace this part:

    var sharedBlacklist = [
      /node_modules[\/\\]react[\/\\]dist[\/\\].*/,
      /website\/node_modules\/.*/,
      /heapCapture\/bundle\.js/,
      /.*\/__tests__\/.*/
    ];
    
    0 讨论(0)
  • 2020-11-28 19:46

    I have also faced this issue. I resolved this following step.

    Check android sdk path in Environment Veritable.

    Add ANDROID_HOME = C:\Users\user_name\AppData\Local\Android\Sdk in System Variable
    and C:\Users\user_name\AppData\Local\Android\Sdk\platform-tools path in System Variable

    replace sharedBlacklist as below code segment,

    var sharedBlacklist = [
      /node_modules[\/\\]react[\/\\]dist[\/\\].*/,
      /website\/node_modules\/.*/,
      /heapCapture\/bundle\.js/,
      /.*\/__tests__\/.*/
    ];
    

    in node_modules/metro-config/src/default/blacklist.js

    Then run npx react-native run-android --port 9001

    Happy Coding..!

    0 讨论(0)
提交回复
热议问题