【问题标题】:Nativescript : : error TS2307: Cannot find module 'image-asset'Nativescript ::错误TS2307:找不到模块'image-asset'
【发布时间】:2023-04-02 08:46:01
【问题描述】:

Android API21 tns 2.3.0

我正在尝试使用nativescript-sdk-examples-ng 实现相机组件

实现代码后,我在运行应用程序时收到此错误 -

tns livesync ios --device 7a3c131309432ebae1a483f134ec8a4f8cdeecf4 --watch

您的应用程序将仅部署在由提供的索引或标识符指定的设备上。 从 /Users/mohit/work/Mobile/native/finly-ng/hooks/before-prepare/nativescript-dev-typescript.js 执行 before-prepare 钩子 找到对等 TypeScript 2.0.3 app/pages/expensephoto/expense-photo.component.ts(2,28): 错误 TS2307: 找不到模块 'image-asset'。

node_modules/nativescript-camera/nativescript-camera.d.ts(1,29):错误 TS2307:找不到模块 'image-asset'。

TypeScript 编译器失败,退出代码为 1

我该如何解决这个问题?

【问题讨论】:

  • 嗨 moaglee,您能否提供有关您正在部署 nativescript-sdk-examples-ng 的设备的更多信息。我在 iOS 和 Android 设备上对其进行了测试,一切都按预期工作。同时,尝试删除 node_modules platformshooks 文件夹。使用npm cache clear 清理缓存并尝试再次构建它tns run <platform_name>

标签: android ios nativescript angular2-nativescript


【解决方案1】:

您所指的示例应用程序正在使用 image-asset 模块所在的 tns-core-modules@next。该模块将与 NativeScript 2.4.0 一起正式发布,预计将在几天内发布。

同时,如果您想试验此功能和其他未发布的功能,您可以像这样安装@next of tns-core-modules。

tns plugin remove tns-core-modules
tns plugin add tns-core-modules@next

现在您的应用程序将可以访问 image-asset。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-08-29
    • 2018-08-29
    • 2017-03-30
    • 2019-07-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-10
    相关资源
    最近更新 更多