Ionic native issue in ionic app

yes, I have read. I uninstall my plugin and reinstalled it.

After uninstalling did you goto inside node_modules folder then @ionic-native folder then delete the plugin folder and use the command in my previous post to start a fresh install of the plugin

1 Like

yes I have followed the same steps metioned by you in your given post. Even I have remove the android platform and regenerate them but nothing happens. same issue occuring.

Check npmjs.org and check the previous version of the plugin you are trying to install and perform the step again using the method then add the version number you get from npmjs.org to it

Please try npm install @ionic-native/barcode-scanner@8.0.0

i have check its version and run command.
I am getting this


it is installig 5.0.0 version of barcode-scanner. running with only npm install @ionic-native/barcode-scanner

Most probably versions of those 2 plugins are incompatible. I had same error a long time ago then i changed versions to compatible ones. I have camera version 2.4.1 and barcode version 6.0.8

If your project is ionic v3 make sure the plugin is not installing 5.0.0 version else you will keep having more problem

Hi dotman,

I have ionic version 3.9.2, it is still installing the barcode scanner version 5.0.0, Before that I have the ionic version 4.9.0. It is installing the barcode scanner version 5.0.0 in both cases. The problem is still there.

Hey Markodemo,

I have tried these versions also but it is not able to find the version.

here is my package.json info:

{
“name”: “prop”,
“version”: “0.0.1”,
“author”: “Ionic Framework”,
“homepage”: “http://ionicframework.com/”,
“private”: true,
“scripts”: {
“start”: “ionic-app-scripts serve”,
“clean”: “ionic-app-scripts clean”,
“build”: “ionic-app-scripts build”,
“lint”: “ionic-app-scripts lint”
},
“dependencies”: {
@angular/animations”: “5.2.11”,
@angular/common”: “5.2.11”,
@angular/compiler”: “5.2.11”,
@angular/compiler-cli”: “5.2.11”,
@angular/core”: “5.2.11”,
@angular/forms”: “5.2.11”,
@angular/http”: “5.2.11”,
@angular/platform-browser”: “5.2.11”,
@angular/platform-browser-dynamic”: “5.2.11”,
@ionic-native/barcode-scanner”: “^5.0.0”,
@ionic-native/core”: “~4.18.0”,
@ionic-native/splash-screen”: “~4.18.0”,
@ionic-native/status-bar”: “~4.18.0”,
@ionic/pro”: “2.0.4”,
@ionic/storage”: “2.2.0”,
“cordova-android”: “7.1.4”,
“cordova-plugin-device”: “^2.0.2”,
“cordova-plugin-ionic-keyboard”: “^2.1.3”,
“cordova-plugin-ionic-webview”: “^2.3.2”,
“cordova-plugin-splashscreen”: “^5.0.2”,
“cordova-plugin-statusbar”: “^2.4.2”,
“cordova-plugin-whitelist”: “^1.3.3”,
“ionic”: “^3.9.2”,
“ionic-angular”: “3.9.2”,
“ionicons”: “3.0.0”,
“npm”: “^6.7.0”,
“phonegap-plugin-barcodescanner”: “8.0.1”,
“rxjs”: “5.5.11”,
“sw-toolbox”: “3.6.0”,
“zone.js”: “0.8.29”
},
“devDependencies”: {
@ionic/app-scripts”: “3.2.1”,
“typescript”: “~2.6.2”
},
“description”: “An Ionic project”,
“cordova”: {
“plugins”: {
“cordova-plugin-whitelist”: {},
“cordova-plugin-statusbar”: {},
“cordova-plugin-device”: {},
“cordova-plugin-splashscreen”: {},
“cordova-plugin-ionic-webview”: {
“ANDROID_SUPPORT_ANNOTATIONS_VERSION”: “27.+”
},
“cordova-plugin-ionic-keyboard”: {},
“phonegap-plugin-barcodescanner”: {}
},
“platforms”: [
“android”
]
}
}

You need to install and specify with @4 to get it installed

you mean, Should i install ionic 4?

1 Like

You have to uninstall it first, then goto node_modules folder then @ionic-native folder then delete the barcode scanner folder. Then go back to your terminal then run npm i @ionic-native/plugin-name@4 --save

3 Likes

yes , It worked . Thank you so much for your help.

You are welcome dude…glad it worked

save my day thanks :slight_smile:

2 Likes

Enjoy the rest of the day man

Update on this. The Ionic Team seem to have sorted it all out with Ionic 4.

$ ionic info

Ionic:

   ionic (Ionic CLI)             : 4.12.0 (C:\Users\thebi\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.3.1
   @angular-devkit/build-angular : 0.13.8
   @angular-devkit/schematics    : 7.3.8
   @angular/cli                  : 7.3.8
   @ionic/angular-toolkit        : 1.5.1

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.1.4
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 6 other plugins)

System:

   Android SDK Tools : 26.1.1 (C:\Users\thebi\AppData\Local\Android\sdk)
   NodeJS            : v10.15.3 (C:\Program Files\nodejs\node.exe)
   npm               : 6.9.0
   OS                : Windows 10

If you follow the docs and install the plugins and ionic native extensions as documented, it will work.

$ ionic cordova plugin add phonegap-plugin-barcodescanner
$ npm install @ionic-native/barcode-scanner

Except if like me, you were migrating a project from V3, and you left one of your imports minus the /ngx. I came across this forum after attempting to add the native barcode scanner. After doing so, I got the errors described here. It turned out that the error that was stuffing me up was that the SplashScreen was not imported correctly into the module. It was missing the /ngx. Now why this didn’t cause the app to fail in the first place, I have no idea, but after updating all my native imports, it works. I’m writing this because who in their right mind wants to jump through a bunch of hoops working with @4 versions of various modules if they don’t have to.

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’;

1 Like