Angular-cli: ng update failed with angular 5 project generated by CLI 1.7.4

Created on 5 May 2018  Â·  12Comments  Â·  Source: angular/angular-cli

Versions

Your global Angular CLI version (6.0.0) is greater than your local
version (1.7.4). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".

    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / â–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/

Angular CLI: 1.7.4
Node: 8.11.1
OS: darwin x64
Angular: 5.2.10
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic, router

@angular/cli: 1.7.4
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.2
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.6.2
webpack: 3.11.0

Repro steps

Observed behavior

An error occurs caused by semver.intersects

Your global Angular CLI version (6.0.0) is greater than your local
version (1.7.4). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
Error: semver.intersects is not a function
semver.intersects is not a function

Desired behavior

Should update successfully

Mention any other details that might be useful (optional)

N.A

high inconvenient bufix

Most helpful comment

npm uninstall @angular/cli --save
npm install @angular/cli --save
ng update @angular/cli

...fixed it for me

All 12 comments

Use the migration guide: https://update.angular.io. You must update your local CLI first

@criduvero I followed the update guide and ran into the same error.
image

at line ng update @angular/cli it throws the same error. I had to use workaround to remove @angular/cli from my project and readd it.

After successfully upgraded all packages, I can't start my application because .angular-cli.json wasn't replaced by angular.json

I updated the @angular/cli to latest version manually. npm install @angular/cli does minor upgrades only

ng update is a CLI 6.0 only command. CLI 1.7.4 did have some support but we disabled it in 1.7.5 to avoid these kind of issues.

You'll need to follow the instructions at update.angular.io like @criduvero said. To make sure you're using CLI 6.0 locally, run ng version.

Running yarn add @angular/cli then ng update @angular/cli worked properly for me.

Closing this as non reproducible in 6.0.1.

@hansl however it is a problem with the update instructions. Following the update instructions exactly does not work for CLI 1.7.4.

Specifically npm install @angular/cli does not upgrade CLI.

@chriscurnow you shoud aware npm install @angular/cli is absolutly not enough.

The correct CLI update is

npm install -g @angular/cli
npm install @angular/cli
ng update @angular/cli

The last command will convert old CLI config into new CLI config and that is the most difficult and crusial step in upgrading 5 to 6

@AlgoTrader , follow the instruction does not work for me.

What I did

npm install -g @angular/cli
npm install @angular/cli
ng update @angular/cli

As @hansl mentioned, Following the update instructions exactly does not work for CLI 1.7.4.

Doing this...

npm install -g @angular/cli
npm install @angular/cli
npm intall
npm run ng update @angular/cli

...fixed it for me.

npm uninstall @angular/cli --save
npm install @angular/cli --save
ng update @angular/cli

...fixed it for me

// Global package

npm uninstall -g @angular/cli
npm cache verify
npm install -g @angular/cli@latest

// Local project package

rm -rf node_modules dist // first remove node modules folder and dist (if applicable)
npm install --save-dev @angular/cli@latest
npm install
ng update @angular/cli
ng update @angular/core

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

daBishMan picture daBishMan  Â·  3Comments

JanStureNielsen picture JanStureNielsen  Â·  3Comments

jmurphzyo picture jmurphzyo  Â·  3Comments

gotschmarcel picture gotschmarcel  Â·  3Comments

brtnshrdr picture brtnshrdr  Â·  3Comments