React Native之unable to load script from assets解决 on windows

前端之家收集整理的这篇文章主要介绍了React Native之unable to load script from assets解决 on windows前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1.进入到项目根目录,在main下建立一个assets文件夹,mkdir 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


3.最后在执行命令: react-native run-android

注意:Using npm version 4.3.0 react-native-cli version 2.01 react-native version 0.49.5.In project directory.

The file name has changed fromindex.android.jstoindex.js.词句意思是说,react-native-cli version 2.01以后index.android.js已经被替换为index.js

因此,执行应变成如下命令:

  • mkdir android/app/src/main/assets
  • 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

原文链接:https://www.f2er.com/react/302108.html

猜你在找的React相关文章