Does anyone encounter this issue when trying to build ionic project with capacitor?
I have an Ionic project which has different packages for each functionality. I am trying to export my project into the android studio using ionic capacitor build android
. I have also tried creating a new project with blank pages and it worked fine. My suspicions here is the native packages but i dont know how to resolve this since i am new to angular and ionic.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @ionic-native/[email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/rxjs
npm ERR! peer rxjs@"^6.5.3 || ^7.4.0" from @angular/[email protected]
npm ERR! node_modules/@angular/common
npm ERR! peer @angular/common@"15.0.2" from @angular/[email protected]
npm ERR! node_modules/@angular/forms
npm ERR! peer @angular/forms@">=12.0.0" from @ionic/[email protected]
npm ERR! node_modules/@ionic/angular
npm ERR! @ionic/angular@"^6.3.9" from the root project
npm ERR! 1 more (the root project)
npm ERR! peer @angular/common@"15.0.2" from @angular/[email protected]
npm ERR! node_modules/@angular/platform-browser
npm ERR! peer @angular/platform-browser@"15.0.2" from @angular/[email protected]
npm ERR! node_modules/@angular/forms
npm ERR! peer @angular/forms@">=12.0.0" from @ionic/[email protected]
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! 3 more (@angular/platform-browser-dynamic, @angular/router, the root project)
npm ERR! peer rxjs@"^6.5.3 || ^7.4.0" from @angular/[email protected]
npm ERR! node_modules/@angular/core
npm ERR! peer @angular/core@"15.0.2" from @angular/[email protected]
npm ERR! node_modules/@angular/common
npm ERR! peer @angular/common@"15.0.2" from @angular/[email protected]
npm ERR! node_modules/@angular/forms
npm ERR! peer @angular/forms@">=12.0.0" from @ionic/[email protected]
npm ERR! node_modules/@ionic/angular
npm ERR! 1 more (the root project)
npm ERR! 4 more (@angular/platform-browser, ...)
npm ERR! peerOptional @angular/core@"15.0.2" from @angular/[email protected]
npm ERR! node_modules/@angular/compiler
npm ERR! peer @angular/compiler@"15.0.2" from @angular/[email protected]
npm ERR! node_modules/@angular/compiler-cli
npm ERR! peer @angular/compiler-cli@"^15.0.0" from @angular-devkit/[email protected]
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! 2 more (@ngtools/webpack, the root project)
npm ERR! 2 more (@angular/platform-browser-dynamic, the root project)
npm ERR! 7 more (@angular/forms, @angular/platform-browser, ...)
npm ERR! 5 more (@angular/forms, @angular/router, @ionic/angular, ...)
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! peer @ionic-native/core@"^5.1.0" from @ionic-native/[email protected]
npm ERR! node_modules/@ionic-native/network
npm ERR! @ionic-native/network@"^5.36.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/rxjs
npm ERR! peer rxjs@"^5.5.0 || ^6.5.0" from @ionic-native/[email protected]
npm ERR! node_modules/@ionic-native/core
npm ERR! peer @ionic-native/core@"^5.1.0" from @ionic-native/[email protected]
npm ERR! node_modules/@ionic-native/network
npm ERR! @ionic-native/network@"^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.
CodePudding user response:
You have a dependency conflict, probably because the @ionic-native
wrappers are not updated anymore and the Ionic is using the latest Angular 15.
Try replacing all of your @ionic-native
packages for their @awesome-cordova-plugins
counterparts.
EX 1: npm un @ionic-native/core && npm i @awesome-cordova-plugins/core
EX 2: npm un @ionic-native/social-sharing && npm i @awesome-cordova-plugins/social-sharing
And so on...
if you encounter the same error while doing that, add the --force flag after each npm i command.