Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When upgrading Angular 5 to 6, I get incompatible peer dependency (using ng update @angular/core)

I am trying to update my Angular app from v5 to v6 following this guide.

I have ran all these commands successfully:

npm install -g @angular/cli npm install @angular/cli ng update @angular/cli 

The problem is that I get an error when running this command:

ng update @angular/core                   Package "@angular/flex-layout" has an incompatible peer dependency to "rxjs" (requires "^5.5.0", would install "6.2.0").                   Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=2.7.2 <2.8", would install "2.6.2") Incompatible peer dependencies found. See above. 

I am not sure how to handle this & I don't want to try things on my own to avoid breaking the app.

Can someone please advise what to do?

My current dependencies are as follows:

{  ....   },   "private": true,   "dependencies": {     "@angular/animations": "^5.2.10",     "@angular/cdk": "^5.2.5",     "@angular/common": "^5.2.10",     "@angular/compiler": "^5.2.10",     "@angular/core": "^5.2.10",     "@angular/flex-layout": "^5.0.0-beta.14",     "@angular/forms": "^5.2.10",     "@angular/http": "^5.2.10",     "@angular/material": "^5.2.5",     "@angular/platform-browser": "^5.2.10",     "@angular/platform-browser-dynamic": "^5.2.10",     "@angular/router": "^5.2.10",     "@ngx-translate/core": "^9.1.1",     "@ngx-translate/http-loader": "^3.0.1",     "core-js": "^2.5.5",     "hammerjs": "^2.0.8",     "primeng": "^5.2.4",     "rxjs": "^5.5.11",     "zone.js": "^0.8.26"   },   "devDependencies": {     "@angular-devkit/build-angular": "~0.6.3",     "@angular/cli": "^6.0.3",     "@angular/compiler-cli": "^5.2.11",     "@angular/language-service": "^5.2.10",     "@types/jasmine": "~2.8.3",     "@types/jasminewd2": "~2.0.2",     "@types/node": "^6.0.106",     "codelyzer": "^4.3.0",     "jasmine-core": "~2.8.0",     "jasmine-spec-reporter": "~4.2.1",     "karma": "^2.0.2",     "karma-chrome-launcher": "~2.2.0",     "karma-coverage-istanbul-reporter": "^1.2.1",     "karma-jasmine": "~1.1.0",     "karma-jasmine-html-reporter": "^0.2.2",     "protractor": "^5.3.2",     "ts-node": "~4.1.0",     "tslint": "~5.9.1",     "typescript": "~2.6.2"   } } 
like image 503
Ahmed Elkoussy Avatar asked May 24 '18 11:05

Ahmed Elkoussy


People also ask

How do you resolve peer dependencies?

Solution 1: Ignore the peerDependencies The easiest way to fix the issue is to pass an additional parameter –legacy-peer-deps to npm install. The --legacy-peer-deps tells the npm to ignore the peer dependencies and continue the installation of the package.

What is peer dependency in Angular?

Peer Dependencies are used to specify that our package is compatible with a specific version of an npm package. Good examples are Angular and React. To add a Peer Dependency you actually need to manually modify your package.json file.

What is latest version of Angular CLI?

The Angular latest Official stable version is Angular v13. 2.5, which is released on 2nd March 2022.


1 Answers

A work around for this would be to add a --force flag.

ng update @angular/core --force 
like image 122
Rusty Avatar answered Sep 17 '22 21:09

Rusty