Frank Andrew
Frank Andrew

Reputation: 917

Ionic 3 error install native plugin after Ionic 4 release

I get a problem using native plugin ionic 3 when install Native Store is success, but when I try to add in app module, the text editor show a red line and when I try to run I found an error like below. Here I install Native-store (https://ionicframework.com/docs/v3/native/native-storage/)

Red line in text editor, successful install but when add in app module show red line. enter image description here

enter image description here

This is error in console when run 'ionic cordova run android'.

[14:40:05]  ionic-app-scripts 3.1.8
[14:40:05]  build dev started ...
[14:40:05]  clean started ...
[14:40:05]  clean finished in 71 ms
[14:40:05]  copy started ...
[14:40:07]  deeplinks started ...
[14:40:08]  deeplinks finished in 1.04 s
[14:40:08]  transpile started ...
[14:40:27]  typescript: D:/myProject/ionic/myApp/src/app/app.module.ts, line: 57
            Argument of type '{ declarations: (typeof VerificationPage | typeof LoginPage | typeof PrivacyRegisterPage |
            typeof...' is not assignable to parameter of type 'NgModule'. Types of property 'providers' are
            incompatible. Type '(typeof SplashScreen | typeof FCM | typeof InAppBrowser | typeof AppVersion | typeof
            Market | typ...' is not assignable to type 'Provider[]'. Type 'typeof SplashScreen | typeof FCM | typeof
            InAppBrowser | typeof AppVersion | typeof Market | type...' is not assignable to type 'Provider'. Type
            'NativeStorageOriginal' is not assignable to type 'Provider'. Type 'NativeStorageOriginal' is not assignable
            to type 'ClassProvider'. Property 'provide' is missing in type 'NativeStorageOriginal'.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
[14:40:27]  ionic-app-script task: "build"
[14:40:27]  Error: Failed to transpile program
Error: Failed to transpile program
    at new BuildError (D:\myProject\ionic\myApp\node_modules\@ionic\app-scripts\dist\util\errors.js:16:28)
    at D:\myProject\ionic\myApp\node_modules\@ionic\app-scripts\dist\transpile.js:159:20
    at Promise (<anonymous>)
    at transpileWorker (D:\myProject\ionic\myApp\node_modules\@ionic\app-scripts\dist\transpile.js:107:12)
    at Object.transpile (D:\myProject\ionic\myApp\node_modules\@ionic\app-scripts\dist\transpile.js:64:12)
    at D:\myProject\ionic\myApp\node_modules\@ionic\app-scripts\dist\build.js:109:82
    at <anonymous>
[ERROR] Command not found: ionic-app-scripts

Please help me to solve this problem.

Thanks.

Upvotes: 5

Views: 12341

Answers (4)

Coder Kamui
Coder Kamui

Reputation: 19

For those that end here running on Ionic 5 just fix your import statement from:

import { BarcodeScanner } from ‘@ionic-native/barcode-scanner’;

to:

import { BarcodeScanner } from ‘@ionic-native/barcode-scanner/ngx’;

Otherwise the above work for Ionic 3.9x and Ionic 4.xx

Upvotes: -1

Usman Kazmi
Usman Kazmi

Reputation: 536

Goto https://www.npmjs.com.

Search for the ionic-native package that you want to install.

In your case, its 'ionic-native-storage'. Check the versions and choose the one which was released before the Ionic 4 Beta release and then install the appropriate version using the same command.

ionic cordova plugin add cordova-plugin-nativestorage@"====add your version here===="

After that the plugin will work the same way as it did. No need to fiddle with adding 'ngx' at the end of the path.

Upvotes: 0

giovannipds
giovannipds

Reputation: 3459

All your @ionic-native modules now need /ngx at the end for Angular projects. Just fix it like this:

import { NativeStorage } from '@ionic-native/native-storage/ngx';

Apply this to every @ionic-native plugin/module.

Upvotes: 13

Krunal Vaghela
Krunal Vaghela

Reputation: 1076

Try To Find .. Second Last Previous Version of Plugin & Append While Adding Plugin

npm install @ionic-native/[email protected]

Here... Latest Version is 5.0.0 So Add @4.19.0 Please Don't Make Assumption Based On
Number Go In Repo or npm link try to find our previous version then append.

Then do your All Step Regularly.

Thanks

Upvotes: 6

Related Questions