0

After trying this a couple of times I cannot for the life of me figure out why these commands don't downgrade Angular CLI...

ng --version 
//Angular CLI: 13.0.3
//Node: 14.15.4
//Package Manager: npm 6.14.10
//OS: win32 x64
npm uninstall -g @angular/cli
npm cache clean --force

npm install -g @angular/cli@11.1.1
ng --version (still getting version 13.0.3. for some reason)

Any ideas what could be affecting this?

Aryan Beezadhur
  • 4,503
  • 4
  • 21
  • 42
Stefan Srbljanin
  • 101
  • 2
  • 12

1 Answers1

0

You need to use npm cache verify instead of npm cache clean --force.

First, ensure the current version of @angular/cli is installed in your machine using the ng --version. For removing the current version, you need to run the following command:

npm uninstall -g @angular/cli You may also need to add sudo at the beginning of your command if you are facing problems in Linux.

by running npm cache verify you can verify the contents of the cache folder, garbage collecting any unneeded data, and verify the integrity of the cache index and all cached data

And then you can install your desired version of @angular/cli by running the following command: npm install -g @angular/cli@11.1.1

Hossein Mousavi
  • 3,118
  • 3
  • 16
  • 35
  • I tried with npm cache verify Cache verified and compressed: Content verified: 464 (14864634 bytes) Index entries: 704 Finished in 1.329s After that, I installed with command as you said, but got the same result. Installing was successful, but version did not change – Stefan Srbljanin Jan 26 '22 at 08:15
  • Any luck on installing your desired version after verifying your NPM cache? @StefanSrbljanin – Hossein Mousavi Jan 26 '22 at 08:16
  • I was following this article in the end and ended up with the same result: https://stackoverflow.com/questions/43070441/cannot-uninstall-angular-cli?rq=1 – Stefan Srbljanin Jan 26 '22 at 08:29
  • You may try restarting your computer, reinstalling node.js (and NPM alongside it), and installing them all from scratch. – Hossein Mousavi Jan 26 '22 at 08:32
  • Tried restarting the machine, downgrading Node.js to version 12.11.0. Tried doing the whole uninstall/reinstall Angular CLI and I'm getting 'The Angular CLI requires a minimum v12.20' and in package.json I still have @angular/cli version "^13.0.3" – Stefan Srbljanin Jan 26 '22 at 10:43