【问题标题】:Issue with Angular 10 / Nativescript 7 npm run ios --deviceAngular 10 / Nativescript 7 npm run ios --device 的问题
【发布时间】:2020-09-21 19:09:11
【问题描述】:

我最近将一个 angular 10 项目迁移到 nativescript 7 并使用 npm run ios 或 npm run android 成功渲染了该应用程序。

我现在面临的问题是,当我运行“npm run ios”时,ios 模拟器会自动始终显示 ipad air 3rd gen。查看文档后,我尝试将 --device 参数与 npm run ios 一起使用(即 npm run ios --device "iPhone 8" 但在尝试这样做时遇到了问题,我收到以下错误:

“输入的'run'命令的子命令无效。”

我们将不胜感激任何帮助,以便我可以开始决定我想使用哪些设备。

干杯!

【问题讨论】:

  • 使用 ns 代替 npm。 Npm run iOS 只是 ns run ios 的糖。使用 ns run ios 后,您可以添加 —device 标志。

标签: nativescript


【解决方案1】:

从聚光灯搜索中,尝试编写“模拟器”,这很可能会启动 iPad。转到“文件->打开模拟器”并选择一个 iPhone。一旦开始,关闭iPad并运行 ns 设备列表

这应该会产生类似

┌───┬────────────────────┬──────────┬──────────────────────────────────────┬──────────┬───────────┬─────────────────┐
│ # │ Device Name        │ Platform │ Device Identifier                    │ Type     │ Status    │ Connection Type │
│ 1 │ iPhone 8           │ iOS      │ E3270BFF-79A5-44A9-8119-5A398A3EA7CB │ Emulator │ Connected │ Local           │
└───┴────────────────────┴──────────┴──────────────────────────────────────┴──────────┴───────────┴─────────────────┘

然后运行

ns run ios --no-hmr --device E3270BFF-79A5-44A9-8119-5A398A3EA7CB

(该命令需要设备ID,而不是设备名称)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-07
    • 1970-01-01
    • 1970-01-01
    • 2021-04-14
    • 2023-04-01
    • 2020-09-06
    相关资源
    最近更新 更多