angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng update @angular/cli installs angular 8.2.0-next.0

Open viceice opened this issue 7 years ago β€’ 69 comments

🐞 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, the previous version in which this bug was not present was: ....

Updating angular cli from 8.0.6 to 8.1.0 also updates other angular packages to 8.2.0-next.0 (nextnpm tag)

Description

A clear and concise description of the problem...

The cli should update to latest instead of next npm tag.

πŸ”¬ Minimal Reproduction

create a angular workspace with angular 8.0.6 and upgrade to 8.1.0

npx -p @angular/[email protected] ng new bug
cd bug
npx -p @angular/[email protected] ng update @angular/cli

πŸ”₯ Exception or Error




Using package manager: 'yarn'
Collecting installed dependencies...
Found 81 dependencies.
Fetching dependency metadata from registry...
  Package "ng-packagr" has an incompatible peer dependency to "@angular/compiler-cli" (requires "^6.0.0 || ^7.0.0 || ^8.0.0-beta.0 || ^8.1.0-beta.0" (extended), would install "8.2.0-next.0").
  Package "@angular/cdk" has an incompatible peer dependency to "@angular/common" (requires "^8.0.0 || ^9.0.0-0" (extended), would install "8.2.0-next.0").
  Package "jest-preset-angular" has an incompatible peer dependency to "@angular/core" (requires ">=2.0.0", would install "8.2.0-next.0").
  Package "ng-packagr" has an incompatible peer dependency to "@angular/compiler" (requires "^6.0.0 || ^7.0.0 || ^8.0.0-beta.0 || ^8.1.0-beta.0" (extended), would install "8.2.0-next.0").
  Package "jest-preset-angular" has an incompatible peer dependency to "@angular/platform-browser-dynamic" (requires ">=2.0.0", would install "8.2.0-next.0").
Incompatible peer dependencies found.
Peer dependency warnings when installing dependencies means that those dependencies might not work correctly together.
You can use the '--force' option to ignore incompatible peer dependencies and instead address these warnings later.

🌍 Your Environment




Angular CLI: 8.0.6
Node: 10.15.0
OS: win32 x64
Angular: 8.1.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.800.6
@angular-devkit/build-angular      0.800.6
@angular-devkit/build-ng-packagr   0.800.6
@angular-devkit/build-optimizer    0.800.6
@angular-devkit/build-webpack      0.800.6
@angular-devkit/core               8.0.6
@angular-devkit/schematics         8.0.1
@angular/cdk                       8.0.2
@angular/cli                       8.0.6
@ngtools/json-schema               1.2.0
@ngtools/webpack                   8.0.6
@schematics/angular                8.0.1
@schematics/update                 0.800.6
ng-packagr                         5.3.0
rxjs                               6.5.2
typescript                         3.4.5
webpack                            4.30.0

Anything else relevant?

viceice avatar Jul 03 '19 08:07 viceice

Bottom line, ng update doesn't work. It get the following errors when attempting to upgrade from Angular 7.

Package "@angular/compiler-cli" has an incompatible peer dependency to "@angular/compiler" (requires "9.0.0-next.0", would install "8.2.0") Package "codelyzer" has an incompatible peer dependency to "@angular/compiler" (requires ">=2.3.1 <7.0.0 || >6.0.0-beta <7.0.0" (extended), would install "8.2.0"). Package "codelyzer" has an incompatible peer dependency to "@angular/core" (requires ">=2.3.1 <7.0.0 || >6.0.0-beta <7.0.0" (extended), would install "8.2.0").

sergiofincast avatar Aug 05 '19 23:08 sergiofincast

ng update definitely has some problems... material as well. On my end, that's when I try to upgrade @angular/material, it tries to install 9.0.0-next.0 for several packages.

I'm upgrading from 7.1.2. Everything went perfectly until I tried to upgrade @angular/material and @angular/cdk. This is a real PITA...

maroy1986 avatar Aug 06 '19 00:08 maroy1986

Similar problem here - updating from 8.1.1 -> 8.2.0. A combined ng update @angular/cli @angular/core updates both to 8.2.0. But when running ng update @angular/material afterwards, all angular dependencies (except for material, cdk and cli) are updated to 9.0.0-next.0

I have the exact same issue!

These steps helped me resolved the problem:

  • Manually edit the version numbers of the depencies which changed to ~9.0.0-next.0" in package.json. Example: "@angular/common": "~9.0.0-next.0" to "@angular/common": "^8.1.2",
  • Remove node_modules folder
  • Run npm install

rubenb994 avatar Aug 07 '19 16:08 rubenb994

Similar problem here - updating from 8.1.1 -> 8.2.0. A combined ng update @angular/cli @angular/core updates both to 8.2.0. But when running ng update @angular/material afterwards, all angular dependencies (except for material, cdk and cli) are updated to 9.0.0-next.0

I have the exact same issue!

These steps helped me resolved the problem:

  • Manually edit the version numbers of the depencies which changed to ~9.0.0-next.0" in package.json. Example: "@angular/common": "~9.0.0-next.0" to "@angular/common": "^8.1.2",
  • Remove node_modules folder
  • Run npm install

I've gone kinda the same way to resolve the issue. I manually upgrade material and cdk manually with npm and then ran the migration command manually from the schematics of angular CLI. Works perfectly the first time.

maroy1986 avatar Aug 07 '19 16:08 maroy1986

I don't even have Angular Material in my project. Just Angular and Bootstrap, that's all and it doesn't work.

sergiofincast avatar Aug 07 '19 21:08 sergiofincast

In a project with "@angular/core": "~8.1.2", I ran ng update @angular/cli and I got "@angular/cli": "~8.2.0" along with "@angular/core": "~9.0.0-next.0". This seems unexpected to me if I don’t specify --next. I was expecting to go to "@angular/core": "~8.2.0". It seems quite surprising to go from a stable to a preview release.

You can use this repo and commit to reproduce/debug: https://github.com/angular-hispano/angular-hispano/commit/7375b34f6e3f2b1158f7430230d2087e1b18d3a6.

Splaktar avatar Aug 07 '19 21:08 Splaktar

I was able to get around these issues via manually updating my package.json to latest angular/angular material versions. Then running: ng update @angular/cli @angular/core --from 7 --to 8 --migrate-only ng update @angular/material --from 7 --to 8 --migrate-only

Run that without the --migrate-only. Finally installed 8.2.1 and NOT 9.0.0.next... (or whatever) Also uninstall all other packages that throw that incompatible peer-dependency Error and reinstall them afterwards. In my case it was angularx-social-login.

telion2 avatar Aug 12 '19 14:08 telion2

I am having the same issue running this command ng update @angular/cdk @angular/material @angular/material-moment-adapter and getting this error -

Package "ag-grid-angular" has an incompatible peer dependency to "@angular/core" (requires ">=2.1.x" (extended), 
would install "9.0.0-next.2").
                  Package "ag-grid-angular" has an incompatible peer dependency to "@angular/compiler" (requires ">=2.1.x" (extended), would install "9.0.0-next.2").
Incompatible peer dependencies found.
Peer dependency warnings when installing dependencies means that those dependencies might not work correctly together.
You can use the '--force' option to ignore incompatible peer dependencies and instead address these warnings later.

Do not want to use force option but why i am getting this error.

ErVishalM avatar Aug 13 '19 11:08 ErVishalM

@ErVishalM: you are getting this error, because somehow angular cli thinks, that 9.0.0-next.2 is the latest version. You can combine your update command with cli and core (as @heapifyman suggested): ng update @angular/core @angular/cli @angular/cdk @angular/material @angular/material-moment-adapter. Than somehow the correct version is used for peer dependency check (8.2.x).

hpawe01 avatar Aug 13 '19 11:08 hpawe01

It is now having the same problem with the 9.0.0-next.2!

Running ng update:

 Name                               Version                  Command to update
     --------------------------------------------------------------------------------
      @angular/cdk                       8.0.2 -> 8.1.2           ng update @angular/cdk
      @angular/material                  8.0.2 -> 8.1.2           ng update @angular/material

Running ng update @angular/material

Updating package.json with dependency @angular/material @ "8.1.2" (was "8.0.2")...
    Updating package.json with dependency @angular/language-service @ "9.0.0-next.2" (was "8.2.2")...
    Updating package.json with dependency @angular/compiler-cli @ "9.0.0-next.2" (was "8.2.2")...
    Updating package.json with dependency @angular/cdk @ "8.1.2" (was "8.0.2")...
    Updating package.json with dependency @angular/core @ "9.0.0-next.2" (was "8.2.2")...
    Updating package.json with dependency @angular/animations @ "9.0.0-next.2" (was "8.2.2")...
    Updating package.json with dependency @angular/common @ "9.0.0-next.2" (was "8.2.2")...
    Updating package.json with dependency @angular/forms @ "9.0.0-next.2" (was "8.2.2")...
    Updating package.json with dependency @angular/platform-browser @ "9.0.0-next.2" (was "8.2.2")...
    Updating package.json with dependency @angular/router @ "9.0.0-next.2" (was "8.2.2")...
    Updating package.json with dependency @angular/compiler @ "9.0.0-next.2" (was "8.2.2")...
    Updating package.json with dependency @angular/platform-browser-dynamic @ "9.0.0-next.2" (was "8.2.2")...

DenysVuika avatar Aug 13 '19 20:08 DenysVuika

@hpawe01 well not solved from this command also. see run this command -

ng update @angular/core @angular/cli @angular/cdk @angular/material @angular/material-moment-adapter
Using package manager: 'npm'
Collecting installed dependencies...
Found 43 dependencies.
Fetching dependency metadata from registry...
Package '@angular/core' is already up to date.
Package '@angular/cli' is already up to date.
                  Package "ag-grid-angular" has an incompatible peer dependency to "@angular/core" (requires ">=2.1.x" (extended), 
would install "9.0.0-next.2").
                  Package "ag-grid-angular" has an incompatible peer dependency to "@angular/compiler" (requires ">=2.1.x" (extended), would install "9.0.0-next.2").
Incompatible peer dependencies found.
Peer dependency warnings when installing dependencies means that those dependencies might not work correctly together.
You can use the '--force' option to ignore incompatible peer dependencies and instead address these warnings later.

ErVishalM avatar Aug 14 '19 04:08 ErVishalM

I had the exact same issue, but resolved now . following command worked.

ng update @angular/[email protected] @angular/[email protected] @angular/[email protected]

mysongs avatar Aug 14 '19 13:08 mysongs

I hate ng update...

blogcraft avatar Aug 14 '19 20:08 blogcraft

I have the same issue when update @angular/cli 8.1.3 -> 8.2.2

Finally I update in following way:

  • just update core ng update @angular/core
  • update cli with npm, npm i @angular/[email protected], also with cdk & material
  • the build-angular version is related to angular core npm i @angular-devkit/[email protected]

nzbin avatar Aug 16 '19 03:08 nzbin

@nzbin I'm pretty sure this would skip any automatic code migration that would be done by the ng update command. I highly recommend you not to do this, unless someone who knows more about it than me can clear things up.

Ploppy3 avatar Aug 18 '19 20:08 Ploppy3

I can confirm @nzbin case, same here from @angular/cli 8.1.3 -> 8.2.2

In my case it want to install @angular/common 9.0.0-next.2, also when only updating @angular/core

This worked for me: ng update @angular/[email protected] @angular/[email protected]

JohnnyDevNull avatar Aug 19 '19 07:08 JohnnyDevNull

@JohnnyDevNull I am getting the same error - ng update @angular/[email protected] @angular/[email protected]

Collecting installed dependencies...
Found 43 dependencies.
Package '@angular/core' is already at '8.2.2'.
Fetching dependency metadata from registry...
                  Package "ag-grid-angular" has an incompatible peer dependency to "@angular/core" (requires ">=2.1.x" (extended), 
would install "9.0.0-next.2").
                  Package "ag-grid-angular" has an incompatible peer dependency to "@angular/compiler" (requires ">=2.1.x" (extended), would install "9.0.0-next.2").
Incompatible peer dependencies found.
Peer dependency warnings when installing dependencies means that those dependencies might not work correctly together.
You can use the '--force' option to ignore incompatible peer dependencies and instead address these warnings later

Please help us to resolve this issue on priority as we are unable to update angular cli and material

ErVishalM avatar Aug 19 '19 10:08 ErVishalM

Same issue from 7.2.14 to 8.2.2

this worked for me - ng update @angular/[email protected] @angular/[email protected] @angular/[email protected]

IdanCo avatar Aug 20 '19 08:08 IdanCo

Still does not work. How are we supposed to update?

Setting the versions by hand does not work either:

ng update @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected]
Using package manager: 'npm'
Collecting installed dependencies...
Found 51 dependencies.
Fetching dependency metadata from registry...
                  Package "@angular/common" has an incompatible peer dependency to "@angular/core" (requires "9.0.0-next.2" (extended), would install "8.2.2").
                  Package "@angular/platform-browser-dynamic" has an incompatible peer dependency to "@angular/common" (requires "8.2.2", would install "9.0.0-next.2")
                  Package "@angular/platform-browser" has an incompatible peer dependency to "@angular/common" (requires "8.2.2", would install "9.0.0-next.2")
                  Package "@angular/common" has an incompatible peer dependency to "@angular/core" (requires "9.0.0-next.2", would install "8.2.2")
                  Package "@angular/flex-layout" has an incompatible peer dependency to "@angular/common" (requires ">=8.0.0-rc.5", would install "9.0.0-next.2").
                  Package "@angular/router" has an incompatible peer dependency to "@angular/common" (requires "8.2.2", would install "9.0.0-next.2")
                  Package "@angular/forms" has an incompatible peer dependency to "@angular/common" (requires "8.2.2", would install "9.0.0-next.2")
Incompatible peer dependencies found.
Peer dependency warnings when installing dependencies means that those dependencies might not work correctly together.
You can use the '--force' option to ignore incompatible peer dependencies and instead address these warnings later.

qortex avatar Aug 20 '19 09:08 qortex

Guys, this is a showstopper. If this was a commercial release it would be withdrawn until this issue was resolved. As things stand, following the update instructions results in unreleased beta software being installed. You have to resolve this or pull the update instructions.

colmben avatar Aug 21 '19 11:08 colmben