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

Broken ng update for Angular 8 (would install 9.0.0.next-2) #15342

Closed
qortex opened this issue Aug 15, 2019 · 19 comments
Closed

Broken ng update for Angular 8 (would install 9.0.0.next-2) #15342

qortex opened this issue Aug 15, 2019 · 19 comments

Comments

@qortex
Copy link

qortex commented Aug 15, 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, it worked in previous versions.

Description

Here is my ng update:

Using package manager: 'npm'
Collecting installed dependencies...
Found 51 dependencies.
    We analyzed your package.json, there are some packages to update:
    
      Name                               Version                  Command to update
     --------------------------------------------------------------------------------
      @angular/cdk                       8.1.1 -> 8.1.3           ng update @angular/cdk
      @angular/cli                       8.1.2 -> 8.2.2           ng update @angular/cli
      @angular/core                      8.1.2 -> 8.2.2           ng update @angular/core
      @angular/material                  8.1.1 -> 8.1.3           ng update @angular/material

🔥 Exception or Error


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" 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/forms" has an incompatible peer dependency to "@angular/common" (requires "8.2.2", would install "9.0.0-next.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/router" 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.

🌍 Your Environment



     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 8.1.2
Node: 12.6.0
OS: linux x64
Angular: 8.1.2
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.801.2
@angular-devkit/build-angular     0.801.2
@angular-devkit/build-optimizer   0.801.2
@angular-devkit/build-webpack     0.801.2
@angular-devkit/core              8.1.2
@angular-devkit/schematics        8.1.2
@angular/cdk                      8.1.1
@angular/flex-layout              8.0.0-beta.26
@angular/material                 8.1.1
@ngtools/webpack                  8.1.2
@schematics/angular               8.1.2
@schematics/update                0.801.2
rxjs                              6.5.2
typescript                        3.4.5
webpack                           4.35.2
@clydin
Copy link
Member

clydin commented Aug 15, 2019

Duplicate of #14980

@clydin clydin marked this as a duplicate of #14980 Aug 15, 2019
@clydin clydin closed this as completed Aug 15, 2019
@qortex
Copy link
Author

qortex commented Aug 21, 2019

Still not solved. Any idea on a fix? Really breaking workflows here.

@virgile-hogman
Copy link

Same problem here. I'm trying to upgrade from Angular 7 to 8. Let alone the problem with tsickle, i ugraded to 8 with ng update @angular/cli @angular/core. I got core 8.2.3. If i do ng update i get this:

      @angular/cdk                       7.2.1 -> 8.1.3           ng update @angular/cdk
      @angular/material                  7.2.1 -> 8.1.3           ng update @angular/material

Then when i run ng update @angular/material i get all the other angular 8 stuff upgraded to 9.0.0-next.

Fetching dependency metadata from registry...
    Updating package.json with dependency @angular/material @ "8.1.3" (was "7.2.1")...
    Updating package.json with dependency @angular/language-service @ "9.0.0-next.3" (was "8.2.3")...
    Updating package.json with dependency @angular/compiler-cli @ "9.0.0-next.3" (was "8.2.3")...
    Updating package.json with dependency @angular/compiler @ "9.0.0-next.3" (was "8.2.3")...
    Updating package.json with dependency @angular/cdk @ "8.1.3" (was "7.2.1")...
    Updating package.json with dependency @angular/animations @ "9.0.0-next.3" (was "8.2.3")...
    Updating package.json with dependency @angular/common @ "9.0.0-next.3" (was "8.2.3")...
    Updating package.json with dependency @angular/core @ "9.0.0-next.3" (was "8.2.3")...
    Updating package.json with dependency @angular/forms @ "9.0.0-next.3" (was "8.2.3")...
    Updating package.json with dependency @angular/router @ "9.0.0-next.3" (was "8.2.3")...
    Updating package.json with dependency @angular/platform-browser @ "9.0.0-next.3" (was "8.2.3")...
    Updating package.json with dependency zone.js @ "0.10.2" (was "0.9.1")...
    Updating package.json with dependency @angular/platform-browser-dynamic @ "9.0.0-next.3" (was "8.2.3")...
UPDATE package.json (2268 bytes)

Definitely not what was expected, this is quite bad... since i'm just following the official documentation: https://update.angular.io/#7.0:8.0

@virgile-hogman
Copy link

Why is this ticket closed? Now even the other one here #14980 is locked. This is not very helpful... 😒

@virgile-hogman
Copy link

@clydin please can you give us an update on this?

@Salahrddine
Copy link

Salahrddine commented Aug 29, 2019

same probleme here when i run ng update as mentioned below

@angular/cdk                       7.2.1 -> 8.1.3           ng update @angular/cdk
      @angular/material                  7.2.1 -> 8.1.3           ng update @angular/material

i got '9.0.0-next.3'

@jymaps
Copy link

jymaps commented Aug 30, 2019

Why is the ticket closed?

@qortex
Copy link
Author

qortex commented Aug 30, 2019

The ticket is closed as a duplicate of #14980 which is still not resolved -- but too heated so closed. No news since.

@mgechev @clydin Do you have any news to share regarding this issue? As you know, it has been raised 2 months ago now, and is breaking the whole update process for many people at least.

Can you perhaps provide a temporary workaround to update by hand if it's easier? When you are not inside the Angular project team, it is not trivial to know which @angular/xxx to update to which versions, with build packages & all.

In the current state, update.angular.io gives non-working instructions. So for example I cannot update one of my projects that is still in v7.

I'm sure v9 asks for all your attention, please let us know if there is something we can do to help get update-process back again.

@virgile-hogman
Copy link

virgile-hogman commented Sep 2, 2019

The first ticket has been opened 2 months ago (!), still nothing about it and the reference ticket is now closed because "too heated"? I don't want to be mean, but this is not very serious. There might be a reason it becomes too heated seen nothing happens and new people continue to raise the problem... End-users are not supposed to spend time on github looking for this. The bare minimum would be to put a notice and give the workaround in the official documentation: https://update.angular.io/#7.2:8.0 (step : ng update @angular/material).

It turns out the unwanted upgrade 8.2.x -> 9.0.0-next.x also patches many sources files to Angular 9 (!) but -by chance (?)- this does not seem to have any effect. So it seems enough to just patch the package.json afterwards and downgrade manually all the 9.0.0-next to their 8.2.x version before the angular/material upgrade (probably all the angular packages except material & cdk), and run npm install again. But this should not be an acceptable solution for such a tool.

@TJReinert
Copy link

Can we instead just update @angular/material to the correct version and do a

npm install
ng update @angular/material --from 7.0.0 --to 8.0.0 --migrate-only

as a work around? That won't run the migration to 9

@qortex
Copy link
Author

qortex commented Sep 10, 2019

Finally found a workaround:

ng update @angular/cli @angular/core rxjs

(you can probably drop rxjs, it was just lagging behind in my project)

And then update by hand to @angular/cdk": "^8.2.0", and "@angular/material": "^8.2.0", in package.json.

So it seems the issue is located in the Angular Material repo.

@jtsom
Copy link
Contributor

jtsom commented Sep 19, 2019

I know this issue is "closed" as a duplicate - of a locked issue, but this problem STILL exists, even with the latest CLI. ng update now updates all the way to 9.0.0-next.7. As @virgile-hogman said, changes to the package.json file can be reverted/downgraded, but any migrations that touch files for V9 are harder to find and undo.

@virgile-hogman
Copy link

virgile-hogman commented Sep 20, 2019

Finally found a workaround:
ng update @angular/cli @angular/core rxjs
And then update by hand to @angular/cdk": "^8.2.0", and "@angular/material": "^8.2.0", in package.json.

I'm not sure this is enough, because ng update does more than just upgrading the package dependencies, it may patch some source files (just for material in that case). Though you don't want the patch upgrade 8 -> 9 you still want 7 -> 8. As the sources v9 still seem to live well with v8 packages, it's probably the least worst. But who knows what each ng update does? Only angular developers know all the details. As a developer i know some fixes require time but I don't understand why they can't at least provide a clear workaround and even worse, shutting down the discussions. The problem is still here after 3 months.

@tristanlins
Copy link

For me it works in two steps.

# first
$ ng update @angular/cli @angular/core rxjs
# second
$ ng update @angular/cdk @angular/material

Instead of update all together or one by one.

@qortex
Copy link
Author

qortex commented Sep 20, 2019

I'm not sure this is enough, because ng update does more than just upgrading the package dependencies, it may patch some source files (just for material in that case).

You will get the upgrade patches from 7 -> 8 fine with ng update @angular/cli @angular/core rxjs (although they never worked on my codebase in any previous migration I did so far since Angular v5, and I never took the time to investigate - I must be doing something wrong).

I suspect @angular/material does not require code update, so it should be ok. Anyway, it's ok for people already on v8.

As a developer i know some fixes require time but I don't understand why they can't at least provide a clear workaround and even worse, shutting down the discussions. The problem is still here after 3 months.

Totally with you. That's pretty sad all in all.

@michaelsanford
Copy link

michaelsanford commented Sep 24, 2019

In addition to emojis, I'd like to confirm that @tristanlins solution worked for me, and provide my exact process, initial and intermediary states in case it helps anyone; it does not require manually fiddling with package.json.

Process

ng update @angular/cli @angular/core rxjs
git commit -am "update @angular/cli @angular/core rxjs"

ng update @angular/cdk @angular/material
git commit -am "update @angular/cdk @angular/material"

My initial state

Angular CLI: 8.0.6
Node: 12.10.0
OS: win32 x64
Angular: 8.0.3
... 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-optimizer   0.800.6
@angular-devkit/build-webpack     0.800.6
@angular-devkit/core              8.0.6
@angular-devkit/schematics        8.0.6
@angular/cdk                      8.0.2
@angular/cli                      8.0.6
@angular/flex-layout              8.0.0-beta.26
@angular/material                 8.0.2
@ngtools/webpack                  8.0.6
@schematics/angular               8.0.6
@schematics/update                0.800.6
rxjs                              6.4.0
typescript                        3.4.5
webpack                           4.30.0

When updating @angular/cli @angular/core rxjs

> ng update @angular/cli @angular/core rxjs

Your global Angular CLI version (8.3.5) is greater than your local
version (8.0.6). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
Using package manager: 'npm'
Collecting installed dependencies...
Found 37 dependencies.
Fetching dependency metadata from registry...
    Updating package.json with dependency @angular/cli @ "8.3.5" (was "8.0.6")...
    Updating package.json with dependency @angular/core @ "8.2.7" (was "8.0.3")...
    Updating package.json with dependency rxjs @ "6.5.3" (was "6.4.0")...
    Updating package.json with dependency @angular/language-service @ "8.2.7" (was "8.0.3")...
    Updating package.json with dependency @angular/compiler-cli @ "8.2.7" (was "8.0.3")...
    Updating package.json with dependency @angular/animations @ "8.2.7" (was "8.0.3")...
    Updating package.json with dependency @angular/compiler @ "8.2.7" (was "8.0.3")...
    Updating package.json with dependency @angular/forms @ "8.2.7" (was "8.0.3")...
    Updating package.json with dependency @angular/common @ "8.2.7" (was "8.0.3")...
    Updating package.json with dependency @angular/router @ "8.2.7" (was "8.0.3")...
    Updating package.json with dependency @angular/platform-browser @ "8.2.7" (was "8.0.3")...
    Updating package.json with dependency @angular/platform-browser-dynamic @ "8.2.7" (was "8.0.3")...
    Updating package.json with dependency typescript @ "3.5.3" (was "3.4.5")...
    Updating package.json with dependency @angular-devkit/build-angular @ "0.803.5" (was "0.800.6")...
UPDATE package.json (1678 bytes)

> [email protected] postinstall F:\dev\aart\app\ui\node_modules\core-js
> node scripts/postinstall || echo "ignore"


> @angular/[email protected] postinstall F:\dev\aart\app\ui\node_modules\@angular\cli
> node ./bin/postinstall/script.js

added 189 packages from 84 contributors, removed 15 packages, updated 111 packages and audited 20894 packages in 66.409s
found 0 vulnerabilities

ℹ️ Recall that you need a clean working copy to run ng update, so you have to make an intermediary commit here.

When updating @angular/cdk @angular/material

> ng update @angular/cdk @angular/material

Using package manager: 'npm'
Collecting installed dependencies...
Found 37 dependencies.
Fetching dependency metadata from registry...
    Updating package.json with dependency @angular/cdk @ "8.2.0" (was "8.0.2")...
    Updating package.json with dependency @angular/material @ "8.2.0" (was "8.0.2")...
UPDATE package.json (1678 bytes)
updated 2 packages and audited 20894 packages in 10.659s
found 0 vulnerabilities

My final state

Angular CLI: 8.3.5
Node: 12.10.0
OS: win32 x64
Angular: 8.2.7
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.5
@angular-devkit/build-angular     0.803.5
@angular-devkit/build-optimizer   0.803.5
@angular-devkit/build-webpack     0.803.5
@angular-devkit/core              8.3.5
@angular-devkit/schematics        8.3.5
@angular/cdk                      8.2.0
@angular/cli                      8.3.5
@angular/flex-layout              8.0.0-beta.26
@angular/material                 8.2.0
@ngtools/webpack                  8.3.5
@schematics/angular               8.3.5
@schematics/update                0.803.5
rxjs                              6.5.3
typescript                        3.5.3
webpack                           4.39.2

/cc #14980

@virgile-hogman
Copy link

Well now i've already done it but i don't really see what differs here from:

# first
$ ng update @angular/cli @angular/core rxjs <-- why would you even need that here?
# second
$ ng update @angular/cdk @angular/material

...and this what i did following the https://update.angular.io/#7.0:8.0 + checking material

ng update @angular/cli @angular/core
ng update @angular/material <-- which deals apparently with cdk

I don't see the reasoning of the supposedly new (??) solutions here. The order is exactly the same... and i don't think rxjs and cdk change anything.

@virgile-hogman
Copy link

In addition to emojis...

A rationale behind the solution would also help to understand. In first hand, did you first reproduce the original problem with the official update instructions (which already consists in two steps)?

@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 Nov 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants