Angular-cli: Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=3.1.1 <3.3", would install "3.4.5").

Created on 29 May 2019  路  37Comments  路  Source: angular/angular-cli

馃悶 Bug report

Command (mark with an x)


- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [X] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

Yes

Yes, the previous version in which this bug was not present was: ....

Description

Having this issue trying to do an ng update on a pretty stock angular 7 application to angular 8:

ng update @angular/cli
Your global Angular CLI version (8.0.0) is greater than your local
version (7.3.8). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
                  Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=3.1.1 <3.3", would install "3.4.5").
Incompatible peer dependencies found. See above.

package.json:

{
  "name": "sample-player",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~7.2.0",
    "@angular/common": "~7.2.0",
    "@angular/compiler": "~7.2.0",
    "@angular/core": "~7.2.0",
    "@angular/forms": "~7.2.0",
    "@angular/platform-browser": "~7.2.0",
    "@angular/platform-browser-dynamic": "~7.2.0",
    "@angular/router": "~7.2.0",
    "core-js": "^2.5.4",
    "rxjs": "~6.3.3",
    "tslib": "^1.9.0",
    "videogular2": "^6.4.0",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.13.0",
    "@angular/cli": "~7.3.8",
    "@angular/compiler-cli": "~7.2.0",
    "@angular/language-service": "~7.2.0",
    "@types/node": "~8.9.4",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "~4.5.0",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.2.2"
  }
}

馃敩 Minimal Reproduction

馃敟 Exception or Error





馃實 Your Environment





schematicupdate high broken

Most helpful comment

Also, do we have to do a git commit after every update operation??

ng update @angular/core
Repository is not clean.  Please commit or stash any changes before updating.

All 37 comments

Also, do we have to do a git commit after every update operation??

ng update @angular/core
Repository is not clean.  Please commit or stash any changes before updating.

Also related to https://github.com/angular/angular-cli/issues/13095

@jtsom, you can run multiple migrations as such: ng update @angular/cli @angular/core

I did see #13095 but wanted to specifically target the new 8.0 (where it says it supports Typescript 3.4 - except where it doesn't....)

I was able to get the update to run using the --force flag, but it looks like the operations that are run after the update (updating tsconfig.json, tslint.json, etc) were not run. How do I re-run those schematics to get everything up to date?

You can run ng update @angular/cli--from 7 --to 8 --migrate-only

Except:

ng update @angular/cli --from 7 --to 8 --migrate-only
Using package manager: 'npm'
Collecting installed dependencies...
Found 32 dependencies.
Invalid Version: 7

@jtsom, yeah there is another issue with command, kindly see https://github.com/angular/angular-cli/issues/14559#issuecomment-496933988

Ran into this as well. The only way I could get angular to upgrade 8 (from 7) was to use npm install @angular/[email protected] --save-dev (opposed to ng update @angular/cli

once I did this, I ran into the issue @jtsom called out:

Repository is not clean. Please commit or stash any changes before updating.

Once I committed the changes and ran ng update --all, I get more warnings:

Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=3.4 <3.5", would install "3.5.1")
                  Package "@angular-devkit/build-angular" has an incompatible peer dependency to "typescript" (requires ">=3.1 < 3.5", would install "3.5.1")
                  Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=3.4 <3.5", would install "3.5.1").
Incompatible peer dependencies found. See above.

@mswilson4040 same problem, Finally I use npm to update angular, like this:

npm install @angular/cli@latest @angular-devkit/build-angular@latest  --save-dev

npm install @angular/{common,compiler,compiler-cli,core,forms,platform-browser,platform-browser-dynamic,platform-server,router,animations}@latest [email protected] --save

After update, you should manually add parameter to ViewChild or ContentChild

Hi, are you running ng update @angular/cli @angular/core? You need to update both the CLI and the framework at the same time.

@alan-agius4 yes, I run ng update @angular/cli at first, and it worked well, but after I run ng update @angular/core , it said Repository is not clean. Please commit or stash any changes before updating
image

I encountered the same issues. The warning is related to your git repo. Committing my recent changes fixed the problem, and I was able to run the ng update commands (i.e. ng update @angular/cli @angular/core)

run this command git status --porcelain and add files and directories to ignore file or commit

run this command git status --porcelain and add files and directories to ignore file or commit

Fixing my git ignore worked for me.

npm install -g @angluar/cli
ng update --all --force
ng add @angular/http 

it work fine for ng server and ng build

i also meet this error.
first,i run

ng update @angular/core

and them

ng update @angular/cli

i don't run

ng update rxjs

now i have upgraded to angular8 and every thing sees ok.
i hope it is helpful

I had the same errors. Here's what worked for me:

I ran the following to update the global version of the Angular CLI:
npm i -g @angular/[email protected]

Then I ran the following to update my angular project:
ng update --all --force

Note: It's important to have a clean, up-to-date repo before running trying to update

run this command git status --porcelain and add files and directories to ignore file or commit

Before you use ng update, you should commit or stash all files

i also meet this error.
first,i run

ng update @angular/core

and them

ng update @angular/cil

i don't run

ng update rxjs

now i have upgraded to angular8 and every thing sees ok.
i hope it is helpful

Thanks, seems to be working!
Btw, you made a little spelling mistake in your ng update @angular/cil command, it should be ng update @angular/cli

On a side note, I had to run ng update @angular/material --from 7 --to 8 --migrate-only multiple times, committing the changes and trying again, because it was throwing FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory after editing my import paths on tons of components.

Thanks for the great work tho!

i also meet this error.
first,i run

ng update @angular/core

and them

ng update @angular/cil

i don't run

ng update rxjs

now i have upgraded to angular8 and every thing sees ok.
i hope it is helpful

Thanks, seems to be working!
Btw, you made a little spelling mistake in your ng update @angular/cil command, it should be ng update @angular/cli

Thanks

Just tried to update another project and got:

ng update @angular/cli @angular/core @angular/cdk @angular/material
Your global Angular CLI version (8.0.1) is greater than your local
version (7.1.4). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
    packageGroup metadata of package @angular/cli is malformed. Ignoring.
    packageGroup metadata of package @angular/cli is malformed.
    packageGroup metadata of package @angular/cli is malformed. Ignoring.
    packageGroup metadata of package @angular/cli is malformed. Ignoring.
    packageGroup metadata of package @angular/cli is malformed.
    packageGroup metadata of package @angular/cli is malformed. Ignoring.
    packageGroup metadata of package @angular/cli is malformed. Ignoring.
    packageGroup metadata of package @angular/cli is malformed.
    packageGroup metadata of package @angular/cli is malformed. Ignoring.
    packageGroup metadata of package @angular/cli is malformed. Ignoring.
                  Package "@ncstate/sat-popover" has an incompatible peer dependency to "@angular/cdk" (requires "^7.0.0", would install "8.0.0").
Incompatible peer dependencies found. See above.

getting worse...

What's the solution for this? Running ng update --all gives a bunch of errors.

                  Package "@angular-devkit/build-angular" has an incompatible peer dependency to "typescript" (requires ">=3.1 < 3.5", would install "3.5.1")
                  Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=3.4 <3.5", would install "3.5.1")
                  Package "ng-packagr" has an incompatible peer dependency to "typescript" (requires ">=2.7 < 3.5", would install "3.5.1")
                  Package "@angular-devkit/build-angular" has an incompatible peer dependency to "typescript" (requires ">=3.1 < 3.5", would install "3.5.1").
Incompatible peer dependencies found. See above.

I've never actually seen ng update --all work. I was able to get things working by doing ng update @angular/core @angular/cli

If ng update --all doesn't work, then it should be removed.

Or at the very least, this message should be changed:

 We analyzed your package.json, there are some packages to update:

      Name                               Version                  Command to update
     --------------------------------------------------------------------------------
      @angular/cli                       7.3.9 -> 8.0.1           ng update @angular/cli
      @angular/core                      7.2.15 -> 8.0.0          ng update @angular/core


    There might be additional packages that are outdated.
    Run "ng update --all" to try to update all at the same time.

Yea, it's immediately suspicious when it reads Run "ng update --all" to _try_ to update all at the same time.

Also having the same issue when running ng update --all:

Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=3.4 <3.5", would install "3.5.1").

Same here, ng update --all throws typescript dependency error, but ng update @angular/core @angular/cli worked.

Am updating the angular 7 to 8, after updating the ng update @angular/cli @angular/core command updated successfully,
but after updating the material through ng update @angular/material entered, then i got the error.
Repository is not clean. Please commit or stash any changes before updating.

Repository is not clean. Please commit or stash any changes before updating.

Commit the changed files into your git repository and the message will disappear.
Likely an enforced checkpoint

It also happened to me, solved it by these steps

  1. remove node_modules and package-lock.json
  2. ng update @angular/core
  3. ng update @angular/cli

The problem is, usually Angular follows new Typescript releases from a few months behind and once there is a new Typescript version, ng update --all becomes unusable. The only solutions that I can think are adding an option to:

  • Add an option to skip updating incompatible dependencies:
ng update --all --skipIncompatible
  • Add an option to exclude some dependencies:
ng update --all --except typescript

yarn add -D typescript@~3.4.0 sorted the problem.

For the moment, typescript will be updated to latest patch on 3.4.x versions. When Angular will allow latest stable typescript, I will update again it using the same command for the new supported minor version.

I once face the same issue was www.allovermyhead.com tried almost every thing getting one error of the other then i tried ng update --all --force;
Done evering was alright.

Seems like ng update is just getting more finicky and fragile with every release.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings