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

ng update @angular/core fails

Open markgoho-EDT opened this issue 8 years ago • 83 comments

Versions

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

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.6.0
@angular-devkit/core         0.6.0
@angular-devkit/schematics   0.6.0
@angular/cli                 6.0.0
@schematics/angular          0.6.0
@schematics/update           0.6.0
rxjs                         5.5.10
typescript                   2.6.2

Repro steps

  • Follow steps at https://update.angular.io/
  • ng update @angular/core

Observed behavior

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

Desired behavior

I would expect this to work properly.

Mention any other details that might be useful (optional)

I tried to manually update the compiler-cli and run the update function again and got this:

$ ng update @angular/core
Invalid range: ">=4.3.0"

markgoho-EDT avatar May 04 '18 00:05 markgoho-EDT

Temporary workaround seems to be skipping the ng update @angular/cli step and instead runing ng update alone first. This seems to update the core (including CLI) but doesn't touch the angular-cli.json file. Then, upon running ng update @angular/cli it does that upgrade process.

markgoho-EDT avatar May 04 '18 00:05 markgoho-EDT

@markgoho-EDT, the ng update itself doesn't do anything else as showing the packages that have to be updated:

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

      Name                               Version                  Command to update
     --------------------------------------------------------------------------------
      @angular/core                      5.0.5 -> 6.0.0           ng update @angular/core
      @angular/material                  5.2.0 -> 6.0.0           ng update @angular/material
      rxjs                               5.5.2 -> 6.1.0           ng update rxjs


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

Doing ng update --all isn't doing its job either:

ng update --all
                  Package "karma-jasmine-html-reporter" has a missing peer dependency of "jasmine" @ "^3.0.0".
                  Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=2.7.2 <2.8", would install "2.8.3")
                  Package "@auth0/angular-jwt" has an incompatible peer dependency to "@angular/common" (requires "^4.4.6||^5.0.0", would install "6.0.0")
                  Package "ng2-pdf-viewer" has a missing peer dependency of "pdfjs-dist" @ "2.0.489".
Invalid range: ">=6.0.0-rc.0"

lordgreg avatar May 04 '18 06:05 lordgreg

I updated the cli first with ng update @angular/cli. Running ng update @angular/core after that gives me the error Invalid range: ">=4.3.0||>5.0.0".

Jrubzjeknf avatar May 04 '18 08:05 Jrubzjeknf

So, the Invalid range: ... doesn't say much. It could at least state from which package.json (aka from which node module this is coming from)

lordgreg avatar May 04 '18 08:05 lordgreg

I tried to run ng update @angular/core after updating the cli and my terminal shows this:

[[24;154R

Invalid range: ">=2.3.0 <3.0.0||>=4.0.0"

bop10 avatar May 04 '18 08:05 bop10

Same here. I tried to different versions of Typescript (2.4, 2.6, 2.7, 2.8) and i get different "Invalid range" error each time: Invalid range: ">=5.0.0" Invalid range: ">=2.3.1 <3.0.0||>=4.0.0" Invalid range: ">=4.3.0||>5.0.0"

Theo59 avatar May 04 '18 08:05 Theo59

It's always such a pain in the a** to update node packages, ffs.

Same : Invalid range: ">=2.3.1 <3.0.0||>=4.0.0"

gnujeremie avatar May 04 '18 09:05 gnujeremie

same for me, just did npm install @angular/[email protected] npm install @angular/[email protected] ... for all @angular/... package and it was ok

IterationCorp avatar May 04 '18 09:05 IterationCorp

@IterationCorp - this doesn't update your configuration files then, which means your karma, tslint and angular config won't get updated at all.

lordgreg avatar May 04 '18 09:05 lordgreg

Same here,

$ ng update --all
                  Package "angular2-moment" has an incompatible peer dependency to "@angular/core" (requires ">=2.0.0 <6.0.0", would install "6.0.0")
                  Package "countup.js-angular2" has an incompatible peer dependency to "ts-node" (requires "~3.2.0", would install "6.0.2").
                  Package "bootstrap" has a missing peer dependency of "popper.js" @ "^1.14.3".
                  Package "ng2-dnd" has an incompatible peer dependency to "@angular/core" (requires "^4.0.0 || ^5.0.0", would install "6.0.0")
Invalid range: ">=4.0.1||>5.0.0||<=6.0.0"

kublaios avatar May 04 '18 09:05 kublaios

try ng update --all --force but even ng update seems still in beta step or out of scope

elvisbegovic avatar May 04 '18 10:05 elvisbegovic

Same: Invalid range: ">=5.0.0"

MarkStega avatar May 04 '18 12:05 MarkStega

Same here: Invalid range ">2.4.2"

PierreRoudaut avatar May 04 '18 13:05 PierreRoudaut

I had the same issue. Upgraded my angular packages manually yarn add @angular/$PACKAGE, run ng update @angular/core again.

frohrka avatar May 04 '18 13:05 frohrka

Workaround:

  1. Update manually the angular packages to 6.0.0
  2. ng update rxjs
  3. ng update angular/core
  4. ng update angular/material
  5. if ng update installs typescript 2.8.3 you have to install typescript version 2.7.2. angular compiler doesn;t work with 2.8.3

tolvaly avatar May 04 '18 14:05 tolvaly

This should have been checked before angular 6.0.0 was released. Now I have to downgrade everything.

bluefire2121 avatar May 07 '18 00:05 bluefire2121

My workaround: remove @angular/compiler-cli from package.json run ng update @angular/core npm i --save-dev @angular/compiler-cli@latest

seems to work :D

Mallfurion avatar May 07 '18 12:05 Mallfurion

I was experiencing the same problem reported by @markgoho-EDT, with some changes I was able to fix it, bellow you can see my steps, maybe it will help someone else.

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

I was following along the steps from the https://update.angular.io page, but the above error poped when I was trying to run the ng update @angular/core bit.

What I have installed so far:

  • Angular CLI (local and global): 6.0.0
  • Typescript: 2.8.3

My steps:

$ ng update

  Name                               Version                  Command to update
 --------------------------------------------------------------------------------
  @angular/core                      5.2.10 -> 6.0.0          ng update @angular/core
  rxjs                               5.5.10 -> 6.1.0          ng update rxjs


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

$ ng update --all

Package "karma-jasmine-html-reporter" has a missing peer dependency of "jasmine" @ "^3.0.0".
Package "@angular/platform-browser-dynamic" has a missing peer dependency of "@angular/compiler" @ "6.0.0".

$ ng update @angular/core

Package not installed: "@angular/compiler". Skipping.

$ ng update @angular/compiler

Package not installed: "@angular/compiler". Skipping.

$ npm install @angular/compiler -> the compiler was installed, but the version was 5.2.0

+ @angular/[email protected]
removed 7 packages and updated 1 package in 11.763s

$ ng update core -> worked fine, no messages this time

Then, just to be sure, run $ ng update again, and got:

We analyzed your package.json and everything seems to be in order. Good work!

This is what I've done, worked for me, maybe will work for someone else. I think the key step was installing the @angular/compiler again, to force its update.

Note: I've just started this project, so no big changes for me, my dev env was almost pristine.

JuanHB avatar May 07 '18 14:05 JuanHB

I have updated my project to @angular/cli 6.0.0 and typescript to version 2.8.3. Now with 'ng build' i have the following error:

ERROR in The Angular Compiler requires TypeScript >=2.7.2 and <2.8.0 but 2.8.3 was found instead.

What is the reason? What can i do?

Here's the dependencies in my my package.json:

"dependencies": { "@angular/animations": "^6.0.0", "@angular/common": "^6.0.0", "@angular/compiler": "^6.0.0", "@angular/core": "^6.0.0", "@angular/forms": "^6.0.0", "@angular/http": "^6.0.0", "@angular/platform-browser": "^6.0.0", "@angular/platform-browser-dynamic": "^6.0.0", "@angular/platform-server": "^6.0.0", "@angular/router": "^6.0.0", "@angular/service-worker": "^6.0.0", "@ng-idle/core": "^2.0.0-beta.15", "base64-arraybuffer": "^0.1.5", "core-js": "^2.5.6", "font-awesome": "~4.7.0", "intl": "~1.2.5", "lodash": "^4.17.10", "ng2-simple-timer": "^1.3.3", "ngx-cookie-service": "^1.0.10", "npm": "^6.0.0", "primeng": "^5.2.6", "primeng-extensions-wizard": "~2.2.0", "rxjs": "^6.1.0", "web-animations-js": "~2.3.1", "zone.js": "^0.8.26" }, "devDependencies": { "@angular-devkit/build-angular": "~0.6.0", "@angular/cli": "^6.0.0", "@angular/compiler-cli": "^6.0.0", "@types/jasmine": "^2.8.7", "@types/lodash": "^4.14.108", "@types/node": "^10.0.4", "codelyzer": "^4.3.0", "jasmine-core": "~3.1.0", "jasmine-spec-reporter": "~4.2.1", "karma": "^2.0.2", "karma-chrome-launcher": "~2.2.0", "karma-cli": "~1.0.1", "karma-coverage-istanbul-reporter": "^1.4.2", "karma-jasmine": "^1.1.2", "karma-jasmine-html-reporter": "^1.0.0", "protractor": "^5.3.1", "ts-node": "^6.0.3", "tslint": "^5.10.0", "typescript": "^2.8.3" }

bbuehrer avatar May 08 '18 09:05 bbuehrer

If I run ng update I get this result

We analyzed your package.json, there are some packages to update:
Name                               Version                  Command to update
--------------------------------------------------------------------------------
@angular/core                      5.0.5 -> 6.0.0           ng update @angular/core
rxjs                               5.5.10 -> 6.1.0          ng update rxjs

But If I run ng update @angular/core , I get Invalid range: ">=2.0.0"

matteomason avatar May 08 '18 09:05 matteomason