1

I need to downgrade my angular cli from version 9 to version 8. I have tried the following:

npm uninstall -g @angular/cli

npm cache verify

npm install -g @angular/cli@8.x.x

whenever I reinstall it and run ng --version it will still output version 9 packages:

Node: 14.3.0
OS: darwin x64

Angular: 9.1.9
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.7
@angular-devkit/build-angular     0.901.7
@angular-devkit/build-optimizer   0.901.7
@angular-devkit/build-webpack     0.901.7
@angular-devkit/core              7.3.9
@angular-devkit/schematics        7.3.9
@angular/cli                      9.1.7
@ngtools/webpack                  9.1.7
@schematics/angular               9.1.7
@schematics/update                0.901.7
rxjs                              6.5.5
typescript                        3.8.3
webpack                           4.42.0

I really need to roll back to version 8 to fix a breaking change, but am unable to get anything to change from version 9. Running ng serve with version 9 won't compile the app. Is there something I'm missing?

EDIT: I figured out that I had somehow installed a different version of the cli specific to the project that I was working in. I uninstalled both the local cli and the glocal cli and reran npm install -g @angular/cli@8.x.x. The ng --version output is correct now but when I try to run ng serve I get the following error: Cannot determine versions of "@angular/cli". This likely means your local installation is broken. Please reinstall your packages.

C. Trenholm
  • 351
  • 1
  • 10

1 Answers1

1

this worked for me:

ng --version
npm uninstall -g @angular/cli
npm cache clean --force

npm install -g @angular/cli@8
ng --version
Mr.
  • 9,429
  • 13
  • 58
  • 82