"Unable to load script from assets 'index.android.bundle'. Make sure..."

"Unable to load script from assets 'index.android.bundle'. Make sure..."

Metro Bundler 似乎没有加载...它正在打开和关闭,关闭前我看不到里面有任何东西 运行ning。因此,模拟器未 运行 应用程序。

我在 运行ning 之后收到错误:

react-native 初始化项目

react-native 运行-android

**System:**
    OS: Windows 10
    CPU: (2) x64 AMD A4-6300 APU with Radeon(tm) HD Graphics
    Memory: 1.49 GB / 7.21 GB
  Binaries:
    Node: 12.13.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.19.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.12.0 - C:\Program Files\nodejs\npm.CMD
  SDKs:
    Android SDK:
      API Levels: 23, 27, 28
      Build Tools: 23.0.1, 27.0.3, 28.0.3
  IDEs:
    Android Studio: Version  3.5.0.0 AI-191.8026.42.35.5900203
  npmPackages:
    react: 16.9.0 => 16.9.0
    react-native: 0.61.3 => 0.61.3

package.json

{
  "name": "first_app",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "react": "16.9.0",
    "react-native": "0.61.3"
  },
  "devDependencies": {
    "@babel/core": "^7.6.4",
    "@babel/runtime": "^7.6.3",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.9.0",
    "eslint": "^6.6.0",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.56.3",
    "react-test-renderer": "16.9.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

Genymotion Emulator S8 Galaxy

我在之后找到了解决方案:

Replace the code with this one. The path of the file is -

node_modules\metro-config\src\defaults\blacklist.js

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

并且 运行 在根项目文件夹中执行以下命令:

npm i -g jetifier
npx jetify

Link here from GitHub

希望对大家有所帮助。

感谢社区。