38

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.

Evan Wieland
  • 1,445
  • 1
  • 20
  • 36
Salman Tanzil
  • 389
  • 1
  • 3
  • 4
  • Overall, I think it would be nice to control which release of Angular 2 you want to use, especially since it has undergone so many changes prior to its official release. – Daniel Rhoden Oct 03 '16 at 12:42

3 Answers3

57

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 angular-cli@1.0.0-beta.14

The complete upgrade/downgrade guide is on GitHub README.

Yuri
  • 4,254
  • 1
  • 29
  • 46
  • this downloads the latest version for me, not the version I specify in the install command. – Jim Feb 04 '17 at 22:31
  • 1
    @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@`? – Yuri Feb 06 '17 at 09:38
  • 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. – john-g Nov 15 '17 at 21:40
  • @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/cli@1.5.2 – kolexinfos Mar 27 '18 at 11:49
  • @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... – john-g Mar 27 '18 at 12:47
51

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/cli@1.6.8 // or whatever version you need
MyrionSC2
  • 1,248
  • 1
  • 14
  • 24
4
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@1.0.0-beta.14
Engineer
  • 300
  • 1
  • 9
  • In my case, even after cleaning the cache, it always showed the latest angular CLI. After restarting the computer downgraded version appeared correctly. – Dush Jul 22 '23 at 03:32