Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jtsom opened this issue May 29, 2019 · 37 comments

Comments

@jtsom
Copy link
Contributor

jtsom commented May 29, 2019

🐞 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





@jtsom
Copy link
Contributor Author

jtsom commented May 29, 2019

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.

@alan-agius4
Copy link
Collaborator

alan-agius4 commented May 29, 2019

Also related to #13095

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

@jtsom
Copy link
Contributor Author

jtsom commented May 29, 2019

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....)

@alan-agius4 alan-agius4 modified the milestones: needsTriage, 8.0.1 May 29, 2019
@jtsom
Copy link
Contributor Author

jtsom commented May 29, 2019

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?

@alan-agius4
Copy link
Collaborator

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

@jtsom
Copy link
Contributor Author

jtsom commented May 29, 2019

Except:

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

@alan-agius4
Copy link
Collaborator

@jtsom, yeah there is another issue with command, kindly see #14559 (comment)

@marc-wilson
Copy link

marc-wilson commented May 29, 2019

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.

@tc9011
Copy link

tc9011 commented May 30, 2019

@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

@alan-agius4
Copy link
Collaborator

alan-agius4 commented May 30, 2019

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

@tc9011
Copy link

tc9011 commented May 30, 2019

@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

@kswarthout
Copy link

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)

@TomySmit
Copy link

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

@RogierdeRuijter
Copy link

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

Fixing my git ignore worked for me.

@huyinghuan
Copy link

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

it work fine for ng server and ng build

@damingerdai
Copy link

damingerdai commented May 31, 2019

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

@KylerJohnson26
Copy link

KylerJohnson26 commented May 31, 2019

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

@tc9011
Copy link

tc9011 commented Jun 1, 2019

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

@Laurens-makel
Copy link

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

@matheo
Copy link

matheo commented Jun 1, 2019

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!

@damingerdai
Copy link

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

@jtsom
Copy link
Contributor Author

jtsom commented Jun 2, 2019

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...

@fr0
Copy link

fr0 commented Jun 4, 2019

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.

@marc-wilson
Copy link

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

@fr0
Copy link

fr0 commented Jun 4, 2019

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.

@marc-wilson
Copy link

marc-wilson commented Jun 4, 2019

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

@astronaute77
Copy link

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").

@Random90
Copy link

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

@kishore0207
Copy link

kishore0207 commented Jun 11, 2019

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.

@deeja
Copy link

deeja commented Jun 11, 2019

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

@Kolahzary
Copy link

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

clydin added a commit to clydin/angular-cli that referenced this issue Jun 13, 2019
The language within the message specifies that update all will _try_ to update all the packages.  In practice and especially for larger projects, this operation will mostly likely not succeed.  This can lead to the users attempting to use the all option with the force option which has a decent probability to break the project via incorrect peer dependency installation or other incompability version increases (packages that don't follow semver, for instance).

Reference: angular#14561 (comment)
kyliau pushed a commit that referenced this issue Jun 13, 2019
The language within the message specifies that update all will _try_ to update all the packages.  In practice and especially for larger projects, this operation will mostly likely not succeed.  This can lead to the users attempting to use the all option with the force option which has a decent probability to break the project via incorrect peer dependency installation or other incompability version increases (packages that don't follow semver, for instance).

Reference: #14561 (comment)
kyliau pushed a commit that referenced this issue Jun 13, 2019
The language within the message specifies that update all will _try_ to update all the packages.  In practice and especially for larger projects, this operation will mostly likely not succeed.  This can lead to the users attempting to use the all option with the force option which has a decent probability to break the project via incorrect peer dependency installation or other incompability version increases (packages that don't follow semver, for instance).

Reference: #14561 (comment)
@salemdar
Copy link

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

@madalinignisca
Copy link

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.

@alan-agius4 alan-agius4 modified the milestones: 8.0.x, 8.1.x Jul 2, 2019
@alan-agius4
Copy link
Collaborator

Duplicate of #13095

@Sirjiskit
Copy link

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.

@marc-wilson
Copy link

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

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests