Search code examples
angulartypescriptupgrade

Getting error when upgrading from Angular 10 to 11


I'm trying to upgrade from Angular 10 to 11. When I run the following command, I get an error.

ng update @angular/core@11 @angular/cli@11

The installed local Angular CLI version is older than the latest stable version.

Installing a temporary version to perform the update.

Installing packages for tooling via npm.

Installed packages for tooling via npm.

Using package manager: 'npm'

Collecting installed dependencies...

Found 44 dependencies.

Fetching dependency metadata from registry...

                  Package "@angular-devkit/build-angular" has an incompatible peer dependency to 
"typescript" (requires "~4.0.0 || ~4.1.0", would install "4.3.5")

                  Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=4.0 <4.2", would install "4.3.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 "C:\Users\DEFAUL~1.DES\AppData\Local\Temp\ng-13szno\angular-errors.log" for further details.

I'm not sure what the error is. I looked at the package.json file and I already have typescript 4.3.5.


Solution

  • Try by adding --force parameter to the command and ignore the warnings.

    ng update @angular/core@11 @angular/cli@11 --force