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

ng update @angular/core fails with error message Invalid range: ">=4.3.0||>5.0.0" #10683

Closed
robbaman opened this issue May 6, 2018 · 8 comments

Comments

@robbaman
Copy link

robbaman commented May 6, 2018

Versions

Angular CLI: 6.0.0
Node: 9.3.0
OS: win32 x64
Angular: 5.2.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.0
@angular-devkit/build-angular     0.6.0
@angular-devkit/build-optimizer   0.6.0
@angular-devkit/core              0.6.0
@angular-devkit/schematics        0.6.0
@angular/cli                      6.0.0
@ngtools/webpack                  6.0.0
@schematics/angular               0.6.0
@schematics/update                0.6.0
rxjs                              5.5.10
typescript                        2.5.3
webpack                           4.6.0

Repro steps

I have a pretty simple Angular 5.2 (CLI 1.7.4) project

  • Used the steps specified by https://update.angular.io/
  • Upgraded the CLI to 6.0.0
  • When reaching the step to update the @angular/core framework package using ng update @angular/core I get an error.

Observed behavior

I get an error message:

Invalid range: ">=4.3.0||>5.0.0"

Desired behavior

I'd expect the framework package to be updated

Mention any other details that might be useful (optional)

It'd be great if there at least was some some information or logging on what is going on.

When using the --force flag the error remains but is then accompanied with the following warning:

Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=2.7.2 <2.8", would install "2.5.3")

@bop10
Copy link

bop10 commented May 6, 2018

Dup of #10621

@hansl
Copy link
Contributor

hansl commented May 8, 2018

Closing this as it's a dupe of #10621.

@hansl hansl closed this as completed May 8, 2018
@Rumsha001
Copy link

Hey,
After alot of research, I have come up with following solution and got success in updating my local project to Angular 6.0.1:

  1. npm install @angular/{animations,common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router}@'6.0.1'
  2. ng update rxjs
  3. npm install rxjs@6 rxjs-compat@6 --save
  4. ng update @angular/core
  5. ng update @angular/material
  6. npm install typescript@'>=2.7.0 <2.8.0'

Please respond and share! Thanks

@luchillo17
Copy link

luchillo17 commented Jun 4, 2018

I had a similar one with message >= 2.0.0, i had version 6.0.1 and updating to 6.0.3, what saved my day was to execute ng update @angular/cli to update the cli first.

@iposton
Copy link

iposton commented Jun 4, 2018

@Rumsha001 your solution really helped me get up-to-date with the latest angular version.

One thing I had to do different was step 6 (install typescript 2.7.2) before I could update @angular/core. and I am not using angular material so I skipped that one. I did this:

  1. npm install @angular/{animations,common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router}@'6.0.1'
  2. ng update rxjs
  3. npm install rxjs@6 rxjs-compat@6 --save
  4. npm install typescript@'>=2.7.0 <2.8.0'
  5. ng update @angular/core

result:

Angular CLI: 6.0.7
Node: 8.11.1
OS: darwin x64
Angular: 6.0.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.7
@angular-devkit/build-angular     0.6.7
@angular-devkit/build-optimizer   0.6.7
@angular-devkit/core              0.0.25
@angular-devkit/schematics        0.0.48
@angular/cli                      6.0.7
@ngtools/json-schema              1.1.0
@ngtools/webpack                  6.0.7
@schematics/angular               0.6.7
@schematics/schematics            0.0.13
@schematics/update                0.6.7
rxjs                              6.2.0
typescript                        2.7.2
webpack                           3.11.0

Thank you!

@robbaman
Copy link
Author

robbaman commented Jun 5, 2018

Rick Strahl also describes a method on his blog that seems to work: https://weblog.west-wind.com/posts/2018/May/09/Updating-my-AlbumViewer-to-ASPNET-Core-21-and-Angular-60

This is what he said:

The proper order to do the upgrade is:

  • Remove the global Angular CLI npm uninstall -g @angular/cli
  • Remove local Angular CLI if installed Angular CLI (if installed) npm uninstall @angular/cli
  • Install the latest Angular CLI globally npm install -g @angular/cli
  • Nuke the node_modules folder
  • Nuke the `package-lock.json file (IMPORTANT!)
  • Run ng update
  • npm install to ensure you get latest

package-lock.json was the one that got me - I did everything else, but because I didn't delete the package-lock.json file at just the right time I ended up restoring the wrong versions. It took me a few go-arounds to make sure that the final npm install was pulling all the right files.

@jkjha
Copy link

jkjha commented Dec 20, 2018

@robbaman that actually worked for me

@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 9, 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

8 participants