The module does not have an exported member of "IonicNativePlugin", Ionic2

I try to work with a camera, file, file system and transfer plugin, and I get this error for each of them,

Module 'node_modules/@ionic-native/core/index' has no exported member 'IonicNativePlugin' 

I got the latest version of Ionic2.

package.json file on request

 "dependencies": { "@angular/common": "4.0.0", "@angular/compiler": "4.0.0", "@angular/compiler-cli": "4.0.0", "@angular/core": "4.0.0", "@angular/forms": "4.0.0", "@angular/http": "4.0.0", "@angular/platform-browser": "4.0.0", "@angular/platform-browser-dynamic": "4.0.0", "@ionic-native/camera": "^3.6.0", "@ionic-native/core": "3.4.2", "@ionic-native/file": "^3.6.0", "@ionic-native/file-path": "^3.6.0", "@ionic-native/splash-screen": "3.4.2", "@ionic-native/status-bar": "3.4.2", "@ionic-native/transfer": "^3.6.0", "@ionic/storage": "2.0.1", "crypto-js": "3.1.9-1", "fast-sha256": "1.0.0", "ionic-angular": "3.0.1", "ionic-native": "^3.5.0", "ionicons": "3.0.0", "rxjs": "5.1.1", "sha256": "0.2.0", "sw-toolbox": "3.4.0", "ts-md5": "1.2.0", "zone.js": "^0.8.4" devDependencies": { "@ionic/app-scripts": "1.3.0", "typescript": "~2.2.1" "cordovaPlugins": [ "cordova-plugin-whitelist", "cordova-plugin-console", "cordova-plugin-statusbar", "cordova-plugin-device", "ionic-plugin-keyboard", "cordova-plugin-splashscreen" "cordovaPlatforms": [], "description": "Work: An Ionic project" 

Am I missing something?

+5
source share
5 answers

I found a solution, IonicNativePlugin was added to a newer version of ionic-native / core, so I had to uninstall this and install the latest version 3.6.1, and now the plugin was exported and everything worked fine.

+1
source

IonicNativePlugin works with the latest version (3.6.1) based on the ionic base, so you need to upgrade to the latest version.

Enter this command in the project directory:

 npm install @ionic-native/core --save 

The problem is resolved.

+4
source

npm uninstall --save @ ionic-native / core npm install --save @ ionic-native / core @latest

Do this, and then close everything, including the command line, and open and run again. The problem is resolved.

+1
source

Try the following:

 npm uninstall --save @ionic-native/core npm install --save @ionic-native/ core@latest 
+1
source

If you provide your ts code, this will help solve this problem. Also, since you said that you have the latest angular2, I assume that you are using ionic 3.xx, it would be more helpful if you provided your ionic information.

this is how you should import and use your own Camera, File, FilePath plugins.

First, make sure you install the plugins:

 $ ionic plugin add cordova-plugin-camera $ npm install --save @ionic-native/camera $ ionic plugin add cordova-plugin-file $ npm install --save @ionic-native/file $ ionic plugin add cordova-plugin-filepath $ npm install --save @ionic-native/file-path 

Then you import your plugins on the ts page as follows:

 import { Camera } from '@ionic-native/camera'; import { File } from '@ionic-native/file'; import { FilePath } from '@ionic-native/file-path'; 

Make sure you also add providers to your app.module.ts

 //at the top import the plugins import { File } from '@ionic-native/file'; import { FilePath } from '@ionic-native/file-path'; import { Camera } from '@ionic-native/camera'; ... //inject your plugins in the providers at the bottom of your app.module.ts providers: [{provide: ErrorHandler, useClass: IonicErrorHandler}, File, FilePath, Camera] 
0
source

Source: https://habr.com/ru/post/1267215/


All Articles