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

same Invalid range: ">=4.0.0"

hesampour avatar May 09 '18 20:05 hesampour

I had to manually add the 6.0.0 to all angular components and 2.7.2 to typescript. then it worked.

ninrod avatar May 09 '18 20:05 ninrod

@lakerko Yes, I did.

isametal88 avatar May 09 '18 22:05 isametal88

@isametal88 is your global tsc taking over?

tsc -v

Bjeaurn avatar May 09 '18 22:05 Bjeaurn

I wasn't able to run that command, I tried with this one (it seems to do a similar thing)

npm list -g typescript [..] +-- @angular/[email protected] | -- @schematics/[email protected] | -- [email protected] +-- [email protected] | -- [email protected] -- [email protected] -- [email protected] -- [email protected]

I doubled-check the typescript folder in node_modules and it is 2.7.2.

isametal88 avatar May 10 '18 06:05 isametal88

tsc -v message TS6029: Version 1.5.3

isametal88 avatar May 10 '18 07:05 isametal88

That version is way too old. Explains why your imports etc aren’t working. Your situation seems unrelated to the reported issue.

Bjeaurn avatar May 10 '18 09:05 Bjeaurn

I installed tsc this morning. Which is the old package? I verified my package.json using npm-check and everything seems fine.

isametal88 avatar May 10 '18 11:05 isametal88

same here what is the official recommended way forward here? not giving much confidence in the hyped ng update.

clement911 avatar May 11 '18 05:05 clement911

@clement911 just don't npm update to latest the local angular cli before the ng update and you're ok.

ronzeidman avatar May 11 '18 11:05 ronzeidman

Ran into the "Invalid range" error also, just trying to use ng update @angular/cli to update to 6.0.1, something I think should have been easy. Nope. Ended up doing an npm update to get 6.0.1, but still doing ng update @angular/core (because ng update said it needed to), I'm seeing

Invalid range: ">2.4.2"

No idea what is triggering this - it's pretty much a standard CLI app.

edit: Looks like it is trying to update the core angular packages to 6.0.1, but this error is causing the update to fail. As someone above said, doesn't instill much confidence. (I also ran into a pile of errors doing ng update on a moderately large app)

More info. trying to do ng update --all now returns:

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

My package.json specifies: "typescript": "2.7.2" so it should not even be trying to update typescript...

jtsom avatar May 11 '18 12:05 jtsom

screen shot 2018-05-11 at 6 40 42 pm

imakshath avatar May 11 '18 13:05 imakshath

Similar issues here. I just started a new Angular 6.0.0 project from CLI 6.0.0 a week ago. I could update angular-cli to version 6.0.1 but doing ng update @angular/core shows me Invalid range: ">=5.0.0"

I have [email protected] and [email protected] installed

Anybody facing the same issue trying to update angular/core from 6.0.0 -> 6.0.1 ?

ray-kay avatar May 12 '18 02:05 ray-kay

@ray-kay I had a clean install of 6.0.0. When running ng update --all to try update to the 6.0.1, here is the error I have:

Package "karma-jasmine-html-reporter" has a missing peer dependency of "jasmine" @ ">=3".
Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=2.7.2 <2.8", would install "2.8.3").
Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=2.7.2 <2.8", would install "2.8.3")
Incompatible peer dependencies found. See above.

My package.json contains "typescript": "2.7.2" in devDependencies. That makes no sens to me.

ddahan avatar May 12 '18 17:05 ddahan

@ddahan I had the same issue before I think. Could solve by just update the locale angular cli on its own: ng update @angular/cli

Hope this will help with your issue. After that try: ng update @angular/core and it should say: Invalid range: ">=5.0.0"

ray-kay avatar May 13 '18 02:05 ray-kay

I just run npm update instead ng update and it updated Angular's packages to 6.0.1 without any issues. Maybe an issue in the cli ng update dependency detection?

ray-kay avatar May 13 '18 04:05 ray-kay

Except, for me anyway, when I initially updated to 6.0, the package.json items were set like “@angular/common”: “6.0.0” Locking it to that version. Npm update would not update anything.

jtsom avatar May 13 '18 12:05 jtsom

Hey Everyone, 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'

Rumsha001 avatar May 13 '18 14:05 Rumsha001

Sorry for beeing so negative and off topic, but what's the point for Google to provide a new ng update command supposed to ease things if we need 58 comments in a an issue and 6 steps, to go from 6.0.0 to 6.0.1 in the end? I gave up, I will update this later when tools will be less cumbersome to use.

ddahan avatar May 13 '18 18:05 ddahan

The main problem seems to be with ng update --all not doing its job properly. Following @Rumsha001 's approach seems to work well.

Just don't forget the @s:

  1. ng update @angular/core
  2. ng update @angular/material

I also needed to ng update @angular/cli

dunxen avatar May 15 '18 08:05 dunxen