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

ng update failed with angular 5 project generated by CLI 1.7.4

Open ahnpnl opened this issue 8 years ago • 12 comments

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

  • Step 1: clone this repo example: https://github.com/AhnpGit/ng-update-error and run yarn
  • Step 2: install @angular/cli 6.0.0 by npm install -g @angular/cli
  • Step 3: cd to the cloned example and run ng update

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

ahnpnl avatar May 05 '18 11:05 ahnpnl

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

criduvero avatar May 06 '18 04:05 criduvero

@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

ahnpnl avatar May 06 '18 07:05 ahnpnl

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

AlgoTrader avatar May 07 '18 09:05 AlgoTrader

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 avatar May 14 '18 20:05 hansl

@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 avatar May 17 '18 08:05 chriscurnow

@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 avatar May 17 '18 08:05 AlgoTrader

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

johnqiuwan avatar Jun 09 '18 20:06 johnqiuwan

see https://github.com/angular/angular-cli/issues/9307

JohannesHoppe avatar Jun 10 '18 20:06 JohannesHoppe

Doing this...

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

...fixed it for me.

mikecabana avatar Jun 15 '18 18:06 mikecabana

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

...fixed it for me

hbakir avatar Jun 17 '18 16:06 hbakir

// 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

alvics avatar Jul 26 '18 02:07 alvics

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.