Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=3.1.1 <3.2", would install "3.2.1")
Bug Report or Feature Request (mark with an x)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Command (mark with an x)
- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [x] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Versions
Node Version: v8.11.4
npm Version: 6.4.1
ng Version:
Angular CLI: 7.0.4
Node: 8.11.4
OS: win32 x64
Angular: 7.0.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.10.4
@angular-devkit/build-angular 0.10.4
@angular-devkit/build-optimizer 0.10.4
@angular-devkit/build-webpack 0.10.4
@angular-devkit/core 7.0.4
@angular-devkit/schematics 7.0.4
@angular/cli 7.0.4
@ngtools/webpack 7.0.4
@schematics/angular 7.0.4
@schematics/update 0.10.4
rxjs 6.3.3
typescript 3.1.6
webpack 4.19.1
Repro steps
ng update --all
The log given by the failure
Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=3.1.1 <3.2", would install "3.2.1")
Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=3.1.1 <3.2", would install "3.2.1").
Incompatible peer dependencies found. See above.
Desired functionality
Mention any other details that might be useful
~~Hi @billfranklin~~
~~It's normal behavior.~~
~~Latest @angular/angular-cli:7.1.0 is shipped with typescript:3.1.6 and supports only patches: typescript < 3.2.~~
~~Newest typescript:3.2.1 increments minor version (typescript:3.1.6 in @angular/angular-cli:7.1.0) and should not have breaking changes but it's safer to limit typescript updates to patches.~~
~~See https://semver.org/~~ https://github.com/angular/angular-cli/issues/13095#issuecomment-443523984
Hi @billfranklin It's normal behavior. Latest
@angular/angular-cli:7.1.0is shipped withtypescript:3.1.6and supports only patches:typescript < 3.2. Newesttypescript:3.2.1increments minor version (typescript:3.1.6in@angular/angular-cli:7.1.0) and should not have breaking changes but it's safer to limittypescriptupdates to patches.See https://semver.org/
It's normal behavior for ng update to throw errors? Seems like bad design to me...
This is the error generated while it is trying to update the compiler-cli...should be fixed to NOT try to install an incompatible dependency
@KrzysztofKarol This also makes it impossible to install "@angular/cli" with the latest version of "@angular/core". I don't see how that's normal behaviour. Surely the latest version of the CLI should be compatible with the latest version of the framework?
@billfranklin Sorry, I mistook ng-update with https://www.npmjs.com/package/npm-check-updates. Yes, this is a bug. ng-update should update typescript to latest supported version. But I don't think it will be resolved soon: https://github.com/angular/angular-cli/issues/11138#issuecomment-395494996.
@dalu You can do:
ng update --all --force
and then
npm i [email protected] (or even better: npm i typescript@"<3.2")
@angular/service-worker wrong peerDependency in 7.1.0 angular/angular#27233 is referencing back to this issue!
Will this be updated soon?
#13123
same issue here
rakishii13, this is #13123

and references back here...
this has always been an issue, it's not even new.
Can't ng update just try to install the latest compatible version of TypeScript? Now I have to go through each package and check if it's compatible with Angular because it errors out right away.
I solved this issue via;
ng update --all --force
npm install typescript@">=3.1.1 <3.2"
Not sure if this will help anyone else, but I was running the following to no avail:
ng update --all --force
npm install typescript@">=3.1.1 <3.2"
I needed to add RUN npm install typescript@">=3.1.1 <3.2" to my Dockerfile just after it completed an npm install of my package.json. Not sure if anyone else needs this pointed out, but wanted to mention in case it helps anyone else. Cheers!
I tried updating via the documentation and I was getting an issue with the ng-http-loader package when I attempted to use the update command as documented (ng update @angular/core)
Package "ng-http-loader" has an incompatible peer dependency to "@angular/common" (requires "~7.0.0" (extended), would install "7.2.1").
Package "ng-http-loader" has an incompatible peer dependency to "@angular/core" (requires "~7.0.0" (extended), would install "7.2.1").
So I attempted to update it ng-http-loader by itself and this happened:
ng update ng-http-loader
Updating package.json with dependency @angular/language-service @ "7.2.1" (was "6.1.10")...
Updating package.json with dependency @angular/compiler-cli @ "7.2.1" (was "6.1.10")...
Updating package.json with dependency @angular/animations @ "7.2.1" (was "6.1.10")...
Updating package.json with dependency @angular/forms @ "7.2.1" (was "6.1.10")...
Updating package.json with dependency @angular/core @ "7.2.1" (was "6.1.10")...
Updating package.json with dependency @angular/http @ "7.2.1" (was "6.1.10")...
Updating package.json with dependency @angular/compiler @ "7.2.1" (was "6.1.10")...
Updating package.json with dependency @angular/common @ "7.2.1" (was "6.1.10")...
Updating package.json with dependency @angular/platform-browser @ "7.2.1" (was "6.1.10")...
Updating package.json with dependency @angular/router @ "7.2.1" (was "6.1.10")...
Updating package.json with dependency @angular/platform-browser-dynamic @ "7.2.1" (was "6.1.10")...
Updating package.json with dependency ng-http-loader @ "5.0.0" (was "3.2.0")...
Updating package.json with dependency typescript @ "3.2.4" (was "2.7.2")...
Updating package.json with dependency zone.js @ "0.8.28" (was "0.8.27")...
UPDATE package.json (3402 bytes)
All of my packages updated to v7.2.1 related to Angular.
For what it's worth, I started out just trying:
ng update @angular/cli @angular/core
but that failed with the error in the title of this issue. Next, I tried just upgrading typescript first, then I found I was able update everything else. I found through trial and error that I had to use a specific version of typescript which is 3.1.6.
Here's what I did. I can't guarantee this was all that I did :) but I believe this is what worked:
npm i [email protected] --save-dev --save-exact
ng update @angular/cli
ng update --all --force
So I'm upgraded to angular 7 at least. Got a few compile errors now in my Typescript code which were not there previously but I'm assuming those are related to TS deprecations. I was upgrading from Angular 6.0 -> 7.
This just hit me again with typescript 3.3.4. Why have this automatic update which gets destroyed by the higher version of typescript?
Every time I go on ng update this issue still apears. Even at angular-cli 7.3.6.
It's solved just with:
npm i [email protected]
just after ng update as this is the last typescript version accepted.
Another reproduction with some more details can be found here: https://github.com/angular/angular-cli/issues/14420#issue-443916012
I had the same problem upgrading from [email protected] to the latest 7.2.15 and had the error come up with [email protected] (well within the >= 3.1.1 < 3.3 requirement). The solution was to manually install the following:
npm i ajv@latest
npm i [email protected]
npm audit fix --force
Then my project compiled successfully with zero vulnerabilities or warnings showing up. I hope this helps others getting the same error message