DEV Community

Samira Awad
Samira Awad

Posted on

1

Changing the Angular CLI version

Angular is constantly updating its versions, every 6 months. There are two ways to make the change: using the Node.js version manager or via command line.

a) Via Command Line:
First, check the Angular version you are using with: ng serve. Then, open the terminal in administrator mode and uninstall the current version: npm uninstall -g @angular/cli.

Now, verify that the cache is correct: npm cache verify. If there’s no error, proceed; otherwise, clear the cache with: npm cache clean --force.

Next, install the desired version (in this case, version 16 which installs the most stable version): npm install -g @angular/cli@16. Verify the installation with: ng version.

b) Via NVM:
Select the version of Node.js to use and install the compatible Angular version with: npm install -g @angular/cli@12.2.8. Uninstall de Angular version with:npm uninstall -g @angular/cli@12.2.8. The Angular version will be install only in the Node current version.
Note: The LTS (Long Term Support) version of Node.js is the stable version and is recommended for most production projects as it receives support and security updates.

We can install a different version of angular for each version of node. This will install only on our used node version.

To see the angular version of the node version used, in a cmd WITHOUT ADMINISTRATOR PERMISSIONS, execute ng version. It is important to do this in another cmd to check the versions, since in the administrator permissions console, it will not send the correct data.

And to uninstall we use the command: npm install -g @angular/cli.

Check compatibilities at: https://angular.dev/reference/versions

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (4)

Collapse
 
jangelodev profile image
João Angelo

Hi Samira Awad,
Top, very nice and helpful !
Thanks for sharing.

Collapse
 
samirabawad profile image
Samira Awad

thanks for reading, I'm happy it's useful

Collapse
 
fulldream profile image
Pavel

I recommend using volta instead of nvm, it's fast and much more convenient

Collapse
 
samirabawad profile image
Samira Awad

thank you so much for your recommendation! I will look into it :)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay