angular-cli: 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

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 70
  • Comments: 31

Commits related to this issue

Most upvoted comments

@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 typescript@3.1.6 (or even better: npm i typescript@"<3.2")

EVERY SINGLE TIME

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!

ng update --all --force ~npm install typescript@3.4.5 --save-exact~ (you don’t even need this anymore with angular 8.2.0, it works with the latest typescript@3.5.3)

That’s my version of ng update.

This is not an option since versions always are bumping. E.g. now it states that @angular/core conflicts with latest zone.js version and tsickle conflicts with latest typescript version.

ng update definetly should take care of its own dependencies at least.

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 typescrispt@3.2.4 just after ng update as this is the last typescript version accepted.

npm install typescript@“>=3.1.1 ❤️.2”

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

I had the same problem upgrading from angular-cli@7.1.1 to the latest 7.2.15 and had the error come up with typescript@3.2.4 (well within the >= 3.1.1 < 3.3 requirement). The solution was to manually install the following:

npm i ajv@latest
npm i typescript@3.2.4
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

This just hit me again with typescript 3.3.4. Why have this automatic update which gets destroyed by the higher version of typescript?

i really don’t get this, what is the use of “ng update” when it is not really usable at all? Why is something that updates angular that understands angular not be able to leave typescript alone or upgrade it to the latest supported version?

@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?

ng update --all --force npm install typescript@3.4.5 --save-exact (you don’t even need this anymore with angular 8.2.0, it works with the latest typescript@3.5.3)

That’s my version of ng update.

Very similar to what I have in my package.json file:

  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "update": "ng update --all --force && npm install typescript@3.5.3 && npm install zone.js@0.9.1"
  },

Saves me the headache of updating.

Another reproduction with some more details can be found here: https://github.com/angular/angular-cli/issues/14420#issue-443916012

same issue here