Multiple erreur when I launch the command to install or remove a package in Ionic

Hello,

I encounter issues when I try to install or uninstall a package using NPM.

For example, when I launch the command npm uninstall @awesome-cordova-plugins/barcode-scanner, I get the kind of warning/errors indicated in the list below.

I am not sure to know the better way to correctly fix this problem. Could someone help me with this?

Thanks for your help,
Loïc


The errors:


npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @awesome-cordova-plugins/barcode-scanner@5.37.1
npm WARN Found: @awesome-cordova-plugins/core@6.2.0
npm WARN node_modules/@awesome-cordova-plugins/core
npm WARN   peer @awesome-cordova-plugins/core@"^6.0.1" from @awesome-cordova-plugins/camera@6.2.0
npm WARN   node_modules/@awesome-cordova-plugins/camera
npm WARN     @awesome-cordova-plugins/camera@"^6.2.0" from the root project
npm WARN   2 more (@awesome-cordova-plugins/device-orientation, the root project)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer @awesome-cordova-plugins/core@"^5.1.0" from @awesome-cordova-plugins/barcode-scanner@5.37.1
npm WARN node_modules/@awesome-cordova-plugins/barcode-scanner
npm WARN 
npm WARN Conflicting peer dependency: @awesome-cordova-plugins/core@5.46.0
npm WARN node_modules/@awesome-cordova-plugins/core
npm WARN   peer @awesome-cordova-plugins/core@"^5.1.0" from @awesome-cordova-plugins/barcode-scanner@5.37.1
npm WARN   node_modules/@awesome-cordova-plugins/barcode-scanner
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @awesome-cordova-plugins/barcode-scanner@5.37.1
npm WARN Found: rxjs@6.6.7
npm WARN node_modules/rxjs
npm WARN   rxjs@"6.6.7" from @angular-devkit/architect@0.1202.13
npm WARN   node_modules/@angular-devkit/architect
npm WARN     dev @angular-devkit/architect@"^0.1202.13" from the root project
npm WARN   48 more (@angular-devkit/core, @angular-devkit/build-angular, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer rxjs@"^5.5.0 || ^7.3.0" from @awesome-cordova-plugins/barcode-scanner@5.37.1
npm WARN node_modules/@awesome-cordova-plugins/barcode-scanner
npm WARN 
npm WARN Conflicting peer dependency: rxjs@7.5.7
npm WARN node_modules/rxjs
npm WARN   peer rxjs@"^5.5.0 || ^7.3.0" from @awesome-cordova-plugins/barcode-scanner@5.37.1
npm WARN   node_modules/@awesome-cordova-plugins/barcode-scanner
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @ngrx/effects@14.3.2
npm ERR! Found: @angular/core@12.2.14
npm ERR! node_modules/@angular/core
npm ERR!   peer @angular/core@"12.2.14" from @angular/animations@12.2.14
npm ERR!   node_modules/@angular/animations
npm ERR!     peerOptional @angular/animations@"12.2.14" from @angular/platform-browser@12.2.14
npm ERR!     node_modules/@angular/platform-browser
npm ERR!       peer @angular/platform-browser@"12.2.14" from @angular/forms@12.2.14
npm ERR!       node_modules/@angular/forms
npm ERR!         peer @angular/forms@">=8.2.7" from @ionic/angular@5.9.2
npm ERR!         node_modules/@ionic/angular
npm ERR!         1 more (the root project)
npm ERR!       3 more (@angular/platform-browser-dynamic, @angular/router, the root project)
npm ERR!     @angular/animations@"^12.2.14" from the root project
npm ERR!   peer @angular/core@"12.2.14" from @angular/common@12.2.14
npm ERR!   node_modules/@angular/common
npm ERR!     peer @angular/common@"12.2.14" from @angular/forms@12.2.14
npm ERR!     node_modules/@angular/forms
npm ERR!       peer @angular/forms@">=8.2.7" from @ionic/angular@5.9.2
npm ERR!       node_modules/@ionic/angular
npm ERR!         @ionic/angular@"^5.9.1" from the root project
npm ERR!       1 more (the root project)
npm ERR!     peer @angular/common@"12.2.14" from @angular/platform-browser@12.2.14
npm ERR!     node_modules/@angular/platform-browser
npm ERR!       peer @angular/platform-browser@"12.2.14" from @angular/forms@12.2.14
npm ERR!       node_modules/@angular/forms
npm ERR!         peer @angular/forms@">=8.2.7" from @ionic/angular@5.9.2
npm ERR!         node_modules/@ionic/angular
npm ERR!         1 more (the root project)
npm ERR!       3 more (@angular/platform-browser-dynamic, @angular/router, the root project)
npm ERR!     6 more (@angular/platform-browser-dynamic, @angular/router, ...)
npm ERR!   9 more (@angular/forms, @angular/platform-browser, ...)

All the @awesome-cordova-plugins package versions should match, looks like you have 6.x on some of them but you are trying to install @awesome-cordova-plugins/barcode-scanner 5.x.
Try installing latest @awesome-cordova-plugins/barcode-scanner.

An alternative is to install with --force param so it ignores peer dependency problems, but could cause other issues.

Hello @julio-ionic,

Thanks for your reply!

I actually try to build a new version of my app in Android Studio but I need to use the compileSdkVersion 31 instead of 30.

With the version 30, it works fine but with the version 31, I get a build erreur with the manifest file of the package “capacitor-cordova-android-plugins”. The only library used with this package is the “barcodescanner”.

I have seen that the package “phonegap-plugin-barcodescanner” was archived and so, I suppose I have to switch to another tool and delete this one.

I just tried to update to the latest version of this package but the error is still presents when I try to build in Android Studio :confused:

@awesome-cordova-plugins packages are just wrappers around existing cordova plugins with types for easier use in Angular projects, so always install latest version of them or the version you need to match other @awesome-cordova-plugins packages you have installed. The @awesome-cordova-plugins versions are independent from the actual cordova plugins they wrap.

Your problem is with phonegap-plugin-barcodescanner (GitHub - phonegap/phonegap-plugin-barcodescanner: cross-platform BarcodeScanner for Cordova / PhoneGap).
As you said, it’s archived, and latest release was 4 years ago, so it doesn’t support SDK 31+ because it didn’t exist when the latest release was done and it requires changes to support it.

Thanks for the precisions.

So it is better to uninstall this package and switch to another plugin such as the Capacitor package or is there any solution with the package @ionic-native/barcode-scanner?

@ionic-native is just the previous name of @awesome-cordova-plugins, still a plugin wrapper, and installing that will probably conflict with the @awesome-cordova-plugins.

By checking the phonegap-barcodescanner network tab on GitHub you can see forks and when they were updated
this one was updated today changing the compile to implementation, which is one of the problems that need to be solved, in this case to work with gradle 7

Then this other fork updated 2 days ago made changes to support SDK 31

So you can combine both changes in your own fork and use your fork, or keep searching among the forks until you find one with all the fixes, or switch to the capacitor plugin if it has all the features you need

Ok, many thanks for your explanations!

I will try to fix the issue and test the plugins before switching to another tool.

Thanks again for your help :slight_smile:

Regards,
Loïc