Reputation: 515
I am trying to update an Angular project from version 12 to 13. I am following the guidance from the Angular update website https://update.angular.io/?v=12.0-13.0 .
This is the package.json before the upgrade process started
...
"dependencies": {
"@angular/animations": "~12.2.15",
"@angular/common": "~12.2.15",
"@angular/compiler": "~12.2.15",
"@angular/core": "~12.2.15",
"@angular/forms": "~12.2.15",
"@angular/platform-browser": "~12.2.15",
"@angular/platform-browser-dynamic": "~12.2.15",
"@angular/router": "~12.2.15",
"astronomy-bundle": "~5.17.8",
"bootstrap": "^4.5.2",
"classlist.js": "1.1.20150312",
"core-js": "^2.5.4",
"moment-timezone": "^0.5.31",
"ngx-bootstrap": "^6.2.0",
"popper.js": "^1.14.7",
"rxjs": "~6.6.6"
},
"devDependencies": {
"@angular-devkit/build-angular": "^12.2.15",
"@angular/cli": "~12.2.15",
"@angular/compiler-cli": "~12.2.15",
"@types/jasmine": "~3.3.8",
The error that stops everything is as follows
npm ERR! Found: @angular-devkit/[email protected]
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"^13.2.5" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev @angular-devkit/build-angular@"^13.2.5" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/[email protected]
npm ERR! node_modules/@angular/compiler-cli
npm ERR! peer @angular/compiler-cli@"^13.0.0" from @angular-devkit/[email protected]
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"^13.2.5" from the root project
npm ERR!
Here is the package.json, after the upgrade process started:
...
"dependencies": {
"@angular/animations": "~13.2.5",
"@angular/common": "~13.2.5",
"@angular/compiler": "~13.2.5",
"@angular/core": "~13.2.5",
"@angular/forms": "~13.2.5",
"@angular/platform-browser": "~13.2.5",
"@angular/platform-browser-dynamic": "~13.2.5",
"@angular/router": "~13.2.5",
"astronomy-bundle": "~5.17.8",
"bootstrap": "^4.5.2",
"classlist.js": "1.1.20150312",
"core-js": "^2.5.4",
"d3": "^6.1.1",
"jquery": "^3.5.1",
"leaflet": "^1.7.1",
"leaflet.markercluster": "^1.4.1",
"moment-timezone": "^0.5.31",
"ngx-bootstrap": "^6.2.0",
"popper.js": "^1.14.7",
"rxjs": "~6.6.6"
},
"devDependencies": {
"@angular-devkit/build-angular": "^13.2.5",
"@angular/cli": "~13.2.5",
"@angular/compiler-cli": "~13.2.5",
"@types/jasmine": "~3.3.8"
...
},
"browser": {
"fs": false,
"os": false,
"path": false
}
}
The project is within a docker container. The update starts, updates the package.json and then stops with the error message.
I would be very grateful for any help,
Thanks.
Upvotes: 2
Views: 3539
Reputation: 176
Try removing the package-lock.json & remove the caret before the version number. options to work around the problem : -passing the --force. -Switch to yarn as a package manager
Upvotes: 4
Reputation: 255
It might be because of package-lock.json file is not updated with the latest versions of Angular.
I am able to solve this problem by deleting package-lock.json file and running npm install again.
As my project is new, no problem in deleting package-lock.json file be careful while deleting this file it might cause other issues.
Upvotes: 0