Most likely there were errors in one of those commands. For me, I had to run npm install -g @angular-devkit/core
first and then run the commands:
npm install -g @angular/cli
npm install @angular/cli
In the console output of npm install @angular/cli
you should see:
================================================================================
The Angular CLI configuration format has been changed, and your existing configuration can
be updated automatically by running the following command:
ng update @angular/cli
================================================================================
Then you obviously should run ng update @angular/cli
to finish off the process.
See the Official Update Guide for additional details.