I would like to run "ionic capacitor add ios" and specify the NPM --force argument. The first thing "ionic capacitor add ios" does is execute "npm.cmd i -E @capacitor/[email protected]" when I execute this command. NPM exits out with an error because of version dependences and stops. I can run "npm.cmd i -E @capacitor/[email protected] --force" and it completes. My question is how do I get Ionic to pass the --force to NPM?
Background I recently updated from ionic 4 to 7. We also switched from Cordova to Capacitor 4, and Angular 15. I just created a new project and pulled the old code in 1 component at a time. I updated the plugins as I went. It was easier than you might think.
Previously my project used rxjs version 6.5.0 but Ionic 7 requires 7.5.0 or greater. When I run "npm install" I have several plugins that still require [email protected] and because of this I get lots of warning and install fails.
However, I used "npm install --force" and everything installed. And so far everything works as expected. I was able to add android support with "ionic capacitor add android" without issues. There were warnings, but I have tested the app and everything appears to work fine. All the warnings are related to version dependence.
Now it is time to add iOS support. When I run "ionic capacitor add ios" I get the following errors and iOS is never added:
npm.cmd i -E @capacitor/[email protected] 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.2.9" from @angular/[email protected] npm ERR! node_modules/@angular/forms npm ERR! peer @angular/forms@">=14.0.0" from @ionic/[email protected] npm ERR! node_modules/@ionic/angular npm ERR! @ionic/angular@"^7.0.6" from the root project npm ERR! 1 more (the root project) npm ERR! peer @angular/common@"15.2.9" from @angular/[email protected] npm ERR! node_modules/@angular/platform-browser npm ERR! peer @angular/platform-browser@"15.2.9" from @angular/[email protected] npm ERR! node_modules/@angular/forms npm ERR! peer @angular/forms@">=14.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! 4 more (@angular/platform-browser-dynamic, @angular/router, ...) 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.2.9" from @angular/[email protected] npm ERR! node_modules/@angular/common npm ERR! peer @angular/common@"15.2.9" from @angular/[email protected] npm ERR! node_modules/@angular/forms npm ERR! peer @angular/forms@">=14.0.0" from @ionic/[email protected] npm ERR! node_modules/@ionic/angular npm ERR! 1 more (the root project) npm ERR! 5 more (@angular/platform-browser, ...) npm ERR! peerOptional @angular/core@"15.2.9" from @angular/[email protected] npm ERR! node_modules/@angular/compiler npm ERR! peer @angular/compiler@"15.2.9" 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! 6 more (@angular/forms, @angular/platform-browser, ...) npm ERR! 7 more (@angular/forms, @angular/router, ...) 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/calendar npm ERR! @ionic-native/calendar@"^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/calendar npm ERR! @ionic-native/calendar@"^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.
Any ideas? Thanks.