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
我该如何解决这个问题?
- 嗨 moaglee,您能否提供有关您正在部署 nativescript-sdk-examples-ng 的设备的更多信息。我在 iOS 和 Android 设备上对其进行了测试,一切都按预期工作。同时,尝试删除 node_modules platforms 和 hooks 文件夹。使用 npm cache clear 清理缓存并尝试再次构建它 tns run <platform_name>
您所指的示例应用正在使用 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。
来源:https://www.codenong.com/40358194/