moaglee moaglee - 1 month ago 13
iOS Question

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

I'm trying to implement a camera component using nativescript-sdk-examples-ng

After implementing the code, I get this error on running the app -


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


How can I resolve this ?

Answer

The sample app you are referring is using the tns-core-modules@next where image-asset module is present. This module will be officially released with NativeScript 2.4.0 which is expected in a matter of days.

Meanwhile, if you want to experiment with this and other non-released features you can install the @next of tns-core-modules like this.

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

Now your application will have access to image-asset.