I want to downgrade Angular CLI globally as my project is using older version of it

62,898

Solution 1

You can downgrade your global angular-cli installation to eg. 1.0.0-beta.14 by issuing:

npm uninstall -g angular-cli
npm cache clean
npm install -g [email protected]

The complete upgrade/downgrade guide is on GitHub README.

Solution 2

Just for folks seeing this in the future, nowadays angular cli is named @angular/cli on npm, so the new commands to downgrade are these:

npm uninstall -g @angular/cli
npm install -g @angular/[email protected] // or whatever version you need

Solution 3

npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/[email protected]
Share:
62,898
Salman Tanzil
Author by

Salman Tanzil

Updated on October 17, 2020

Comments

  • Salman Tanzil
    Salman Tanzil over 3 years

    I have upgraded my Angular CLI globally but my project is using an older version of angular CLI, so I want to downgrade my Angular CLI globally.

  • Jim
    Jim about 7 years
    this downloads the latest version for me, not the version I specify in the install command.
  • Yuri
    Yuri about 7 years
    @Jim: I've tried the commands again, and it works - installed version is indeed 1.0.0-beta.14 according to package.json file. Did you really specify your desired version as angular-cli@<version>?
  • john-g
    john-g over 6 years
    as of the latest version of NPM it will basically "heal" itself. you have to run npm clean cache with the --force switch ** also you may just need to exit the terminal and reopen. that has happened to me on win10 with gitbash.
  • kolexinfos
    kolexinfos about 6 years
    @jogi This is so annoying I have uninstalled, cleaned cache with force flag and I keep getting the latest version installed after specifying that I want npm install -g @angular/[email protected]
  • john-g
    john-g about 6 years
    @kolexinfos - check that your package.json for the project in question is specifying this version specifically. Having it installed globally doesn't mean it would be used for a project necessarily. if it is installed locally in your node_modules as the older (but newer) version it might still be using this one. Please take this as a guess though w/o seeing it I can't know. It definitely can be confusing, this is the worst thing about node/ng. good luck...
  • Kushal Bhalaik
    Kushal Bhalaik over 5 years
    Now, this should be the answer.
  • malvadao
    malvadao over 5 years
    the npm cache verify is also a recommended option after npm uninstall -g @angular/cli, being used as an alternative for npm cache clean