How to downgrade Angular CLI version?

AngularAngular Cli

Angular Problem Overview


I'm new in Angular 4 and I am getting this error,

Your global Angular CLI version (6.0.1) is greater than your local
version (1.4.1). The local Angular CLI version is used.

Can you please help me solving this ?

Angular Solutions


Solution 1 - Angular

npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@1.4.1

Solution 2 - Angular

Quick fix :

npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@1.4.1

Explanation :

If you want remove this warning, then you can downgrade your global angular-cli installation to eg. 1.4.1 by running above commands on terminal:

Complete Upgrade and Downgrade guide is on GitHub README.

Your project always uses CLI version on which you have created the project. You can see it in the warning while running ng serve.

If global version is greater than Local version then local version is used.

It is also defined in your package.json file.

"devDependencies": {
    "@angular/cli": "1.5.0",
     ....
} 

CLI warning

Reference Link

Solution 3 - Angular

  1. Do you have other projects which are using angular (and what version of CLI are they using)

  2. Once you identify which version you want to retain, you can uninstall the current version by

global:

npm uninstall -g @angular/cli

or local

npm uninstall @angular/cli

3) Then install desired version in the same scope as you uninstalled (making sure of any dependencies with other components)

global

specific version

npm install -g @angular/cli@1.4.1

latest version

npm install -g @angular/cli

local Same as global but without the "-g" flag

Ideally the versions should be latest unless you figure out any compatibility issues

Edit:

> Angular CLI 6.xxx

has a breaking change of "angular.json" in new vs ".angular.json" in old (difference of dot in file name). Use https://stackoverflow.com/questions/49810580/error-local-workspace-file-angular-json-could-not-be-found if moving to angular 6

Solution 4 - Angular

Do the following to Downgrade/Upgrade

  1. > npm uninstall -g @angular/cli

  2. #Install npm-check-updates > $ npm i -g npm-check-updates

  3. > npm cache clean --force

    If you get error do it manually as below:

    open run , enter %appdata%

    enter image description here

  4. Specify which version you want to install > npm install -g @angular/cli@x.x.x

    This will get the latest cli version: > npm install -g @angular/cli

Solution 5 - Angular

I got the same warning:

> Your global Angular CLI version (11.0.6) is greater than you local > version (11.0.5).

So before unisntalling the old version or downgrading, I took the basic command:

ng update @angular/cli @angular/core

By updating these packages from the registry, the warning was gone and my current project was updated to the latest version.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMukesh PrajapatiView Question on Stackoverflow
Solution 1 - AngularRitwick DeyView Answer on Stackoverflow
Solution 2 - AngularSangwin GawandeView Answer on Stackoverflow
Solution 3 - AngularNitinSinghView Answer on Stackoverflow
Solution 4 - AngularNaveen RamakrishnaView Answer on Stackoverflow
Solution 5 - AngularDomiserverView Answer on Stackoverflow