Node升级 启动RN报错:react-native启动时红屏报错:Unable to load script.Make sure you're either running a metro server or that

 1、 项目中在android/app/src/main/创建文件夹  assets

 2、项目中执行命令

 1、 项目中在android/app/src/main/创建文件夹  assets

 2、项目中执行命令

react-native bundle --platform android --dev false  --entry-file index.android.js --bundle-output
android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

重点就是 如果启动还报错

解决办法:
修改node_modules\metro-config\src\defaults\blacklist.js文件

var sharedBlacklist = [ 
/node_modules[\/\\]react[\/\\]dist[\/\\].*/, 把这句改成这样的
/website\/node_modules\/.*/,
/heapCapture\/bundle\.js/,
/.*\/__tests__\/.*/
];

猜你喜欢

转载自www.cnblogs.com/ruoxiangli/p/12186034.html