I aim to update my existing Angular version to a newer one, specifically targeting version 17.3.0. However, I’ve run into issues with incompatible peer dependencies during the update process. Below are three commands I’ve tried in an attempt to resolve this.
- nvm list
tio@MacBook-Air MySites % nvm list
-> v16.13.2
v16.14.0
v20.0.0
v20.11.1
system
default -> 16.13.2 (-> v16.13.2)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v20.11.1) (default)
stable -> 20.11 (-> v20.11.1) (default)
lts/* -> lts/iron (-> v20.11.1)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.21.3 (-> N/A)
lts/gallium -> v16.20.2 (-> N/A)
lts/hydrogen -> v18.19.1 (-> N/A)
lts/iron -> v20.11.1
tio@MacBook-Air MySites % nvm alias default node
default -> node (-> v20.11.1)
tio@MacBook-Air MySites % node -v
v20.11.1
- ng update @angular/[email protected]
tio@MacBook-Air MySites % ng update @angular/[email protected]
The installed Angular CLI version is outdated.
Installing a temporary Angular CLI versioned 17.3.7 to perform the update.
✔ Packages successfully installed.
Using package manager: npm
Collecting installed dependencies...
Found 22 dependencies.
Fetching dependency metadata from registry...
Updating multiple major versions of '@angular/core' at once is not supported. Please migrate each major version individually.
Run 'ng update @angular/core@16' in your workspace directory to update to latest '16.x' version of '@angular/core'.
For more information about the update process, see https://update.angular.io/?v=15.0-16.0
- ng update @angular/core@16
tio@MacBook-Air MySites % ng update @angular/core@16
The installed Angular CLI version is outdated.
Installing a temporary Angular CLI versioned 16.2.14 to perform the update.
✔ Packages successfully installed.
Using package manager: npm
Collecting installed dependencies...
Found 22 dependencies.
Fetching dependency metadata from registry...
Updating package.json with dependency @angular/compiler-cli @ "16.2.12" (was "15.2.10")...
Updating package.json with dependency @angular/animations @ "16.2.12" (was "15.2.10")...
Updating package.json with dependency @angular/common @ "16.2.12" (was "15.2.10")...
Updating package.json with dependency @angular/compiler @ "16.2.12" (was "15.2.10")...
Updating package.json with dependency @angular/core @ "16.2.12" (was "15.2.10")...
Updating package.json with dependency @angular/forms @ "16.2.12" (was "15.2.10")...
Updating package.json with dependency @angular/platform-browser @ "16.2.12" (was "15.2.10")...
Updating package.json with dependency @angular/platform-browser-dynamic @ "16.2.12" (was "15.2.10")...
Updating package.json with dependency @angular/router @ "16.2.12" (was "15.2.10")...
Updating package.json with dependency zone.js @ "0.13.3" (was "0.12.0")...
UPDATE package.json (1047 bytes)
✔ Packages successfully installed.
** Executing migrations of package '@angular/core' **
❯ In Angular version 15.2, the guard and resolver interfaces (CanActivate, Resolve, etc) were deprecated.
This migration removes imports and 'implements' clauses that contain them.
Migration completed (No changes made).
❯ As of Angular v16, the `moduleId` property of `@Component` is deprecated as it no longer has any effect.
Migration completed (No changes made).
- ng update @angular/[email protected]
tio@MacBook-Air MySites % ng update @angular/[email protected]
The installed Angular CLI version is outdated.
Installing a temporary Angular CLI versioned 17.3.7 to perform the update.
✔ Packages successfully installed.
Using package manager: npm
Collecting installed dependencies...
Found 22 dependencies.
Fetching dependency metadata from registry...
Package "@angular-devkit/build-angular" has an incompatible peer dependency to "@angular/compiler-cli" (requires "^15.0.0" (extended), would install "17.3.0").
Package "@angular-devkit/build-angular" has an incompatible peer dependency to "typescript" (requires ">=4.8.2 <5.0", would install "5.4.5").
✖ Migration failed: Incompatible peer dependencies found.
Peer dependency warnings when installing dependencies means that those dependencies might not work correctly together.
You can use the '--force' option to ignore incompatible peer dependencies and instead address these warnings later.
See "/private/var/folders/ct/xl1gnlvx39n4cqvdxk7y4m1c0000gn/T/ng-BxohLZ/angular-errors.log" for further details.
.. angular-errors.log
[error] Error: Incompatible peer dependencies found.
Peer dependency warnings when installing dependencies means that those dependencies might not work correctly together.
You can use the '--force' option to ignore incompatible peer dependencies and instead address these warnings later.
at _validateUpdatePackages (/private/var/folders/ct/xl1gnlvx39n4cqvdxk7y4m1c0000gn/T/angular-cli-packages-ROEySj/node_modules/@angular/cli/src/commands/update/schematic/index.js:188:15)
at /private/var/folders/ct/xl1gnlvx39n4cqvdxk7y4m1c0000gn/T/angular-cli-packages-ROEySj/node_modules/@angular/cli/src/commands/update/schematic/index.js:698:13
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async callRuleAsync (/private/var/folders/ct/xl1gnlvx39n4cqvdxk7y4m1c0000gn/T/angular-cli-packages-ROEySj/node_modules/@angular-devkit/schematics/src/rules/call.js:77:18)
To try to solve the problem, I executed the following commands:
tio@MacBook-Air MySites % ng update codelyzer@latest
The installed Angular CLI version is outdated.
Installing a temporary Angular CLI versioned 15.2.11 to perform the update.
✔ Packages successfully installed.
Using package manager: npm
Collecting installed dependencies...
Found 22 dependencies.
Package 'codelyzer' is not a dependency.
New contributor
Mattia Davì is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.