angular-cli

Problem with updating Angular CLI from version 11.2.13 to latest version on Mac


I know that there are a lot of advices according to my topic and I read them, used the recommended commands on Mac but I can not update my 11.2.13 CLI to 13 globally.

'ng --version' shows the following now:

Angular CLI: 11.2.13
Node: 16.14.0
OS: darwin x64

Angular: 
 ... 
 Ivy Workspace: 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1102.13 (cli-only)
@angular-devkit/core         11.2.13 (cli-only)
@angular-devkit/schematics   11.2.13 (cli-only)
@schematics/angular          11.2.13 (cli-only)
@schematics/update           0.1102.13 (cli-only)

I tryed to use the following commands with sudo:

npm install -g @angular/cli@latest npm install --save-dev @angular/cli@latest

The second command made files in my user account map and for a second it seemed that I successfully updated my CLI to 13 because 'ng --version' showed the following lines:

Angular CLI: 13.3.3
Node: 16.14.0
Package Manager: npm 8.3.1
OS: darwin x64

Angular: undefined
... 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1303.3
@angular-devkit/core         13.3.3
@angular-devkit/schematics   13.3.3
@angular/cli                 13.3.3
@schematics/angular          13.3.3

but when I deleted the files what were made by the 'npm install --save-dev @angular/cli@latest' command it came back to CLI version 11.2.13 when I typed 'ng --version'.

Could you please recommend me a command or commands which helps me to update my CLI to version 13 globally and not just locally? How can I do that?

Thanks in advance!


Solution

  • The solution was a brute force type... Reinstalling macOS Catalina from scratch. Installing latest Node.js, and after that the latest Angular CLI:

    Angular CLI: 13.3.3
    Node: 16.14.2
    Package Manager: npm 8.5.0
    OS: darwin x64
    

    Now I have that I wanted.