【问题标题】:how to fix this err in andriod simulator: Unable to load script.Make sure you are either running a Metro server如何在 android 模拟器中修复此错误:无法加载脚本。确保您正在运行 Metro 服务器
【发布时间】:2020-02-14 21:47:44
【问题描述】:

我创建了 AwesomeProject 并直接在我的项目的根目录下运行react-native run-android,android 模拟器中的消息如下:

无法加载脚本。请确保您正在运行 Metro 服务器,或者您的捆绑包“index.android.bundle”已正确打包以供发布。

要修复此错误,我尝试运行:
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/
但它没有用。message in android simulator

【问题讨论】:

    标签: react-native react-native-android


    【解决方案1】:

    你必须先启动捆绑器,运行

     npm start 
    

     react-native start 
    

    在项目的根目录中。

    【讨论】:

    • 但是当运行 npm startreact-native 时,启动它会给出:npm ERR! code ELIFECYCLEnpm ERR! errno 126npm ERR! my_app@0.1.0 start:react-native-scripts startnpm ERR! Exit status 126npm ERR! npm ERR! npm ERR! Failed at the my_app@0.1.0 start script.npm ERR! This is probably not a problem with npm. There is likely additional 上面的日志输出。 >
    猜你喜欢
    • 2020-04-12
    • 2020-01-05
    • 2022-08-20
    • 2019-09-30
    • 1970-01-01
    • 1970-01-01
    • 2020-11-13
    • 1970-01-01
    相关资源
    最近更新 更多