Prerequisites
Ionic Framework Version
Current Behavior
(This may be related to #23767 but my version of node.js & npm are up to date)
When trying to update Angular from the v12.2.11 to the v12.2.12 I get the following error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: my-app@0.0.0
npm ERR! Found: @angular-devkit/build-angular@12.2.11
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"~12.2.12" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev @angular-devkit/build-angular@"~12.2.12" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/core@12.2.12
npm ERR! node_modules/@angular/core
npm ERR! peer @angular/core@"12.2.12" from @angular/service-worker@12.2.12
npm ERR! node_modules/@angular/service-worker
npm ERR! peerOptional @angular/service-worker@"^12.0.0" from @angular-devkit/build-angular@12.2.12
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"~12.2.12" 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!
npm ERR! See /home/jmarcou/.npm/eresolve-report.txt for a full report.
Looking at the package.json & package-lock.json I could not see any problem for this to occur, so I went and tried to remove some package one by one until I could update Angular without any dependency conflict.
In the end, just by removing the @ionic/angular dependency, I was able to update Angular, which I'm not able to do otherwise.
Expected Behavior
I should be able to update Angular to v12.2.12 with @ionic/angular being installed
Steps to Reproduce
First, create an Ionic project with @angular/ionic
Here's my package.json:
{
"name": "my-app",
"version": "0.0.0",
"private": true,
"dependencies": {
"@angular/common": "~12.2.11",
"@angular/compiler": "~12.2.11",
"@angular/core": "~12.2.11",
"@angular/forms": "~12.2.11",
"@angular/platform-browser": "~12.2.11",
"@angular/platform-browser-dynamic": "~12.2.11",
"@angular/router": "~12.2.11",
"@capacitor/android": "^3.2.5",
"@capacitor/app": "^1.0.5",
"@capacitor/core": "^3.2.5",
"@capacitor/filesystem": "^1.0.5",
"@capacitor/haptics": "^1.1.2",
"@capacitor/keyboard": "^1.1.2",
"@capacitor/splash-screen": "^1.1.5",
"@capacitor/status-bar": "^1.0.5",
"@cospired/i18n-iso-languages": "^3.1.1",
"@ionic/angular": "^5.8.4",
"@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^6.0.0",
"@robingenz/capacitor-android-dark-mode-support": "^1.0.0",
"i18n-iso-countries": "^6.8.0",
"rxjs": "~6.6.7",
"tslib": "^2.3.1",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~12.2.11",
"@angular-eslint/builder": "^12.6.1",
"@angular-eslint/eslint-plugin": "^12.6.1",
"@angular-eslint/eslint-plugin-template": "^12.6.1",
"@angular-eslint/schematics": "^12.6.1",
"@angular-eslint/template-parser": "^12.6.1",
"@angular/cli": "~12.2.11",
"@angular/compiler-cli": "~12.2.11",
"@capacitor/cli": "^3.2.5",
"@types/node": "^16.11.6",
"@typescript-eslint/eslint-plugin": "^5.2.0",
"@typescript-eslint/parser": "^5.2.0",
"eslint": "^7.32.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-jsdoc": "^37.0.3",
"eslint-plugin-prefer-arrow": "^1.2.3",
"typescript": "~4.3.5"
}
}
Then, run the following command ng update @angular/core @angular/cli
You'll get the Could not resolve dependency error
Code Reproduction URL
No response
Ionic Info
Ionic:
Ionic CLI : 6.18.0 (/home/jmarcou/.nvm/versions/node/v16.13.0/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.8.4
@angular-devkit/build-angular : 12.2.11
@angular-devkit/schematics : 12.2.11
@angular/cli : 12.2.11
@ionic/angular-toolkit : not installed
Capacitor:
Capacitor CLI : 3.2.5
@capacitor/android : 3.2.5
@capacitor/core : 3.2.5
@capacitor/ios : not installed
Utility:
cordova-res : not installed globally
native-run : 1.5.0
System:
NodeJS : v16.13.0 (/home/jmarcou/.nvm/versions/node/v16.13.0/bin/node)
npm : 8.1.0
OS : Linux 5.10 (WSL 2 on Windows 10)
Additional Information
Here is the workaround I found to solve this problem:
- first remove @ionic/angular from your package.json
- then run
ng update with the --allow-dirty option (the only files not commited are the package.json & package-lock.json that have just changed because of the removal of @ionic/angular)
- finally, re-install @ionic/angular
Here is the full command : npm remove @ionic/angular && ng update @angular/core @angular/cli --allow-dirty && npm install @ionic/angular@^5.8.4
Prerequisites
Ionic Framework Version
Current Behavior
(This may be related to #23767 but my version of node.js & npm are up to date)
When trying to update Angular from the v12.2.11 to the v12.2.12 I get the following error:
Looking at the package.json & package-lock.json I could not see any problem for this to occur, so I went and tried to remove some package one by one until I could update Angular without any dependency conflict.
In the end, just by removing the
@ionic/angulardependency, I was able to update Angular, which I'm not able to do otherwise.Expected Behavior
I should be able to update Angular to v12.2.12 with @ionic/angular being installed
Steps to Reproduce
First, create an Ionic project with @angular/ionic
Here's my package.json:
{ "name": "my-app", "version": "0.0.0", "private": true, "dependencies": { "@angular/common": "~12.2.11", "@angular/compiler": "~12.2.11", "@angular/core": "~12.2.11", "@angular/forms": "~12.2.11", "@angular/platform-browser": "~12.2.11", "@angular/platform-browser-dynamic": "~12.2.11", "@angular/router": "~12.2.11", "@capacitor/android": "^3.2.5", "@capacitor/app": "^1.0.5", "@capacitor/core": "^3.2.5", "@capacitor/filesystem": "^1.0.5", "@capacitor/haptics": "^1.1.2", "@capacitor/keyboard": "^1.1.2", "@capacitor/splash-screen": "^1.1.5", "@capacitor/status-bar": "^1.0.5", "@cospired/i18n-iso-languages": "^3.1.1", "@ionic/angular": "^5.8.4", "@ngx-translate/core": "^13.0.0", "@ngx-translate/http-loader": "^6.0.0", "@robingenz/capacitor-android-dark-mode-support": "^1.0.0", "i18n-iso-countries": "^6.8.0", "rxjs": "~6.6.7", "tslib": "^2.3.1", "zone.js": "~0.11.4" }, "devDependencies": { "@angular-devkit/build-angular": "~12.2.11", "@angular-eslint/builder": "^12.6.1", "@angular-eslint/eslint-plugin": "^12.6.1", "@angular-eslint/eslint-plugin-template": "^12.6.1", "@angular-eslint/schematics": "^12.6.1", "@angular-eslint/template-parser": "^12.6.1", "@angular/cli": "~12.2.11", "@angular/compiler-cli": "~12.2.11", "@capacitor/cli": "^3.2.5", "@types/node": "^16.11.6", "@typescript-eslint/eslint-plugin": "^5.2.0", "@typescript-eslint/parser": "^5.2.0", "eslint": "^7.32.0", "eslint-plugin-import": "^2.25.2", "eslint-plugin-jsdoc": "^37.0.3", "eslint-plugin-prefer-arrow": "^1.2.3", "typescript": "~4.3.5" } }Then, run the following command
ng update @angular/core @angular/cliYou'll get the
Could not resolve dependencyerrorCode Reproduction URL
No response
Ionic Info
Additional Information
Here is the workaround I found to solve this problem:
ng updatewith the--allow-dirtyoption (the only files not commited are the package.json & package-lock.json that have just changed because of the removal of @ionic/angular)Here is the full command :
npm remove @ionic/angular && ng update @angular/core @angular/cli --allow-dirty && npm install @ionic/angular@^5.8.4