Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 481
Frank Andrew Avatar asked Jan 25 '19 08:01

Frank Andrew


2 Answers

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.

like image 89
giovannipds Avatar answered Oct 10 '22 01:10

giovannipds


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

like image 20
Krunal Vaghela Avatar answered Oct 10 '22 00:10

Krunal Vaghela