Search code examples
npmionic-frameworkrxjsionic-native

@Ionic/Angular peer dependency on rxjs conflicts with @ionic-native/core


I have a dependency issue in my @ionic/angular 7.1.1 project.

@ionic-native/core latest ver 5.36 appears to have a peer dependency on an rxjs version compatible with 5.5.0 or 6.5.0.

A screenshot of the NPM page for the ionic native core package's dependency file showing a peer dependency on rxjs compatible with version 5.5 or 6.5

I can't install this rxjs version because @ionic/angular 7.1.1 requires rxjs >= 7.5.0.

A screenshot of the NPM page for the ionic angular package's dependency file showing a peer dependency on rxjs greater than or equal to version 7.5.0

So how do I get around this?

Project Info:

Ionic CLI                     : 7.0.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework               : @ionic/angular 7.1.1
@angular-devkit/build-angular : 16.1.3
@angular-devkit/schematics    : 16.1.3
@angular/cli                  : 16.1.3
@ionic/angular-toolkit        : 9.0.0

Capacitor:

Capacitor CLI      : 5.1.0
@capacitor/android : not installed
@capacitor/core    : 5.1.0
@capacitor/ios     : not installed

Utility:

cordova-res (update available: 0.15.4) : 0.15.2
native-run (update available: 1.7.3)   : 1.7.2

System:

NodeJS : v18.14.0 (/usr/local/bin/node)
npm    : 9.3.1
OS     : macOS Catalina

Error:

npm i @ionic-native/native-page-transitions
   
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/rxjs
npm ERR!   rxjs@"^7.8.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer rxjs@"^5.5.0 || ^6.5.0" from @ionic-native/[email protected]
npm ERR! node_modules/@ionic-native/core
npm ERR!   @ionic-native/core@"^5.36.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution

I tried adding backward compatibility for modules with dependencies of rxjs versions up to 6.6.7, in my package.json:

"rxjs": "^7.8.1",
"rxjs-compat": "^6.6.7",

Then I deleted my node_modules folder, package-lock.json file, and ran npm install but I still had issues.

@ionic-native/core and @ionic-native/native-page-transitions are both latest versions 5.36 and they require rxjs 5.5.0 or 6.5.0, so not sure why rxjs-compact 6.6.7 doesn't provide backward compatibility needed.


Solution

  • As of ~ September 27, 2021 all Cordova plugins were moved to a community maintainer. You will need to move all @ionic-native/* packages to their new package name: @awesome-cordova-plugins/*.

    npm install cordova-plugin-name
    npm install @awesome-cordova-plugins/name
    

    Awesome Cordova plugin list