关于android:Nativescript ::错误TS2307:找不到模块’image-asset’

Nativescript : : error TS2307: Cannot find module 'image-asset'

Android API21
tns 2.3.0

我正在尝试使用 nativescript-sdk-examples-ng

实现相机组件

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

tns livesync ios --device 7a3c131309432ebae1a483f134ec8a4f8cdeecf4 --watch

Your application will be deployed only on the device specified by the provided index or identifier.
Executing before-prepare hook from /Users/mohit/work/Mobile/native/finly-ng/hooks/before-prepare/nativescript-dev-typescript.js
Found peer TypeScript 2.0.3
app/pages/expensephoto/expense-photo.component.ts(2,28): error TS2307: Cannot find module 'image-asset'.

node_modules/nativescript-camera/nativescript-camera.d.ts(1,29): error TS2307: Cannot find module 'image-asset'.

TypeScript compiler failed with exit code 1

我该如何解决这个问题?


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

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

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

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