Hi,
Summary of the problem
I have a mobile application project in Ionic5. I have successfully run the command npm install
, but when I run ionic cordova platform add android
I have this error :
sudo ionic cordova platform add android
> cordova platform add android
Using cordova-fetch for cordova-android
Failed to fetch platform cordova-android
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
CordovaError: Error: Command failed with exit code 1: npm install cordova-android --save-dev
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @angular/animations@10.2.5
npm ERR! Found: @angular/core@9.1.13
npm ERR! node_modules/@angular/core
npm ERR! peer @angular/core@"9.1.13" from @angular/common@9.1.13
npm ERR! node_modules/@angular/common
npm ERR! peer @angular/common@"^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0" from @angular/fire@6.1.5
npm ERR! node_modules/@angular/fire
npm ERR! @angular/fire@"^6.0.2" from the root project
npm ERR! peer @angular/common@"9.1.13" from @angular/forms@9.1.13
npm ERR! node_modules/@angular/forms
npm ERR! peer @angular/forms@">=8.2.7" from @ionic/angular@5.9.4
npm ERR! node_modules/@ionic/angular
npm ERR! @ionic/angular@"^5.0.0" from the root project
npm ERR! 1 more (the root project)
npm ERR! 4 more (@angular/platform-browser, ...)
npm ERR! peer @angular/core@"^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0" from @angular/fire@6.1.5
npm ERR! node_modules/@angular/fire
npm ERR! @angular/fire@"^6.0.2" from the root project
npm ERR! 8 more (@angular/forms, @angular/platform-browser, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@"10.2.5" from @angular/animations@10.2.5
npm ERR! node_modules/@angular/animations
npm ERR! @angular/animations@"^10.0.2" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/core@10.2.5
npm ERR! node_modules/@angular/core
npm ERR! peer @angular/core@"10.2.5" from @angular/animations@10.2.5
npm ERR! node_modules/@angular/animations
npm ERR! @angular/animations@"^10.0.2" 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.
npm ERR!
My environment & package.json
MacOS Ventura
NodeJs v18.16.0
Npm 9.6.7
Ionic -v : 7.1.1
Dependencies of Package.json :
"dependencies": {
"@angular/animations": "^10.2.5",
"@angular/common": "~10.2.5",
"@angular/core": "~10.2.5",
"@angular/fire": "^6.0.2",
"@angular/forms": "~10.2.5",
"@angular/platform-browser": "~10.2.5",
"@angular/platform-browser-dynamic": "~10.2.5",
"@angular/router": "~10.2.5",
"@awesome-cordova-plugins/core": "^5.45.0",
"@capacitor/core": "2.2.1",
"@ionic-native/core": "^5.0.7",
"@ionic-native/geolocation": "^5.27.0",
"@ionic-native/globalization": "^5.27.0",
"@ionic-native/google-maps": "^5.5.0",
"@ionic-native/in-app-browser": "^5.27.0",
"@ionic-native/market": "^5.27.0",
"@ionic-native/network": "^5.27.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/sqlite": "^5.27.0",
"@ionic-native/sqlite-porter": "^5.27.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic/angular": "^5.9.4",
"@ionic/storage": "^2.2.0",
"@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^4.0.0",
"compare-func": "^2.0.0",
"cordova-android": "~7.0.0",
"cordova-androidx-build": "^1.0.4",
"cordova-ios": "^5.1.1",
"cordova-plugin-geolocation": "^4.0.2",
"cordova-plugin-globalization": "^1.11.0",
"cordova-plugin-googlemaps": "github:mapsplugin/cordova-plugin-googlemaps#multiple_maps",
"cordova-plugin-googlemaps-sdk": "github:mapsplugin/cordova-plugin-googlemaps-sdk",
"cordova-plugin-inappbrowser": "^4.0.0",
"cordova-plugin-network-information": "^2.0.2",
"cordova-plugin-whitelist": "^1.3.4",
"cordova-sqlite-storage": "^5.0.0",
"firebase": "^7.15.5",
"rxjs": "~6.5.1",
"tslib": "^2.0.0",
"uk.co.workingedge.cordova.plugin.sqliteporter": "^1.1.1",
"web-animations-js": "^2.3.2",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1002.4",
"@angular/cli": "10.2.4",
"@angular/compiler": "~10.2.5",
"@angular/compiler-cli": "~10.2.5",
"@angular/language-service": "~10.2.5",
"@capacitor/cli": "2.2.1",
"@ionic/angular-toolkit": "^2.1.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"cordova-plugin-device": "^2.1.0",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^4.2.1",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.0.8"
},
What I tried
- I tried different versions of Angular, NodeJs and Ionic …
- I had completely uninstall all npm package and Node Js
- Deleted package.json
- Deleted node_module directory
- Clean npm cache
- Re-run npm install (successfuly again)
But same probleme …
I have no idea why it finds @angular/core@9.1.13
when the installed version is ~10.2.5
if anyone has an idea it will save my day
THANKS