Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular Update 10.2 to 11

I'm trying to update Angular in my project from version 10.2 to 11.0. Running ng update:

  @angular-devkit/build-angular      0.1002.0 -> 0.1100.1     ng update @angular-devkit/build-angular
  @angular/cdk                       10.2.7 -> 11.0.0         ng update @angular/cdk
  @angular/cli                       10.2.0 -> 11.0.1         ng update @angular/cli
  @angular/core                      10.2.3 -> 11.0.0         ng update @angular/core
  @angular/material                  10.2.7 -> 11.0.0         ng update @angular/material

Unfortunately each package I tried to update fails. I tried with --force and --allowDirty flags.

@angular-cli

npm ERR! Found: @angular-devkit/[email protected]
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR!   dev @angular-devkit/build-angular@"~0.1100.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! dev @angular-devkit/build-angular@"~0.1100.1" 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@"^11.0.0 || ^11.0.0-next" from @angular-devkit/build- 
[email protected]
npm ERR!   node_modules/@angular-devkit/build-angular
npm ERR!     dev @angular-devkit/build-angular@"~0.1100.1" from the root project

@angular-devkit/build-angular

npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: @angular-devkit/[email protected]
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR!   dev @angular-devkit/build-angular@"~0.1100.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! dev @angular-devkit/build-angular@"~0.1100.1" 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@"^11.0.0 || ^11.0.0-next" from @angular-devkit/[email protected]
npm ERR!   node_modules/@angular-devkit/build-angular
npm ERR!     dev @angular-devkit/build-angular@"~0.1100.1" from the root project

@angular/material

Installing packages (npm)...npm ERR! code ERESOLVE
npm ERR! Cannot read property 'length' of undefined

@angular/cdk

Found: @angular-devkit/[email protected]
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR!   dev @angular-devkit/build-angular@"~0.1100.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! dev @angular-devkit/build-angular@"~0.1100.1" 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@"^11.0.0 || ^11.0.0-next" from @angular-devkit/build- 
[email protected]
npm ERR!   node_modules/@angular-devkit/build-angular
npm ERR!     dev @angular-devkit/build-angular@"~0.1100.1" from the root project

UPDATE After installing with specific order I managed to update, but now the NPM won't install giving this message:

Found: @angular-devkit/[email protected]
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR!   dev @angular-devkit/build-angular@"~0.1100.1" from the root 
project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! dev @angular-devkit/build-angular@"~0.1100.1" 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@"^11.0.0 || ^11.0.0-next" from 
@angular-devkit/[email protected]
npm ERR!   node_modules/@angular-devkit/build-angular
npm ERR!     dev @angular-devkit/build-angular@"~0.1100.1" from the 
root project
like image 988
Kajetanoss Avatar asked Nov 13 '20 11:11

Kajetanoss


People also ask

How do I upgrade Angular to 11?

You can run ng add @angular/localize to include required packages. Finally, run ng update @angular/core @angular/cli command to update to Angular 11. This will migrate your project to latest Angular release. After the update to Angular 11 is done your project will be using Typescript 4.

How do I upgrade from Angular 9 to 12?

This was announced in the v10 update. Run ng update @angular/core@12 @angular/cli@12 which should bring you to version 12 of Angular. Angular now requires TypeScript 4.2. ng update will update you automatically.

How to upgrade from angular 10 to angular 11?

Now it was time to upgrade from Angular 10.2 to Angular 11.1. The command and its output are shown below: npx ng update @angular/cli@11 @angular/core@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.

How to update the angular CLI version in NPX?

The command and its output are shown below: npx ng update @angular/cli@11 @angular/core@11 The installed local Angular CLI version is older than the latest stable version. Installing a temporary version to perform the update.

What happened to viewencapsulation in angular 11?

❯ ViewEncapsulation.Native has been removed as of Angular version 11. This migration replaces any usages with ViewEncapsulation.ShadowDom. Migration completed. ❯ NavigationExtras omissions migration. In version 11, some unsupported properties were omitted from the `extras` parameter of the `Router.navigateByUrl` and `Router.createUrlTree` methods.

What is the difference between @angular/core and@angular/http?

Package "@angular/cdk" has an incompatible peer dependency to "@angular/core" (requires "^8.0.0 || ^9.0.0-0" (extended), would install "11.0.3"). Package "@angular/http" has an incompatible peer dependency to "@angular/platform-browser" (requires "7.2.16" (extended), would install "11.0.3").


1 Answers

I had the exact same problem, tried different orders for upgrades, removed node_modules folder several times, and had still no luck. For me, the problem was that I was using Node v15. I uninstalled it and re-installed Node v14 -> works

like image 161
Daniel Bunte Avatar answered Sep 23 '22 19:09

Daniel Bunte