Blog Posts: Latest Trends and Insights in Technologies | Clarion Technologies

How To Install NVM On Windows, Linux, And Mac?

Written by Binny Vyas | Jul 20, 2023 10:13:08 AM

Are you ready to embark on an exciting journey into Node.js and take control of your software development like a true wizard? We've got just the magical tool for you - NVM, the Node Version Manager! With NVM by your side, you can effortlessly run unique JavaScript code in your web browser and on servers, giving your projects the power they deserve!  

"What is NVM?" you ask. Well, imagine a magical wand that lets you switch between different versions of Node.js with a mere flick of your fingers! 🎯 Whether you're on Windows, Linux, or Mac, NVM works its enchantment to ensure each project gets the perfect Node.js version it needs. Let's dive into the spellbinding installation process! 

How to install NVM on Windows - 

Download NVM: Begin your magical journey by heading to the official NVM repository on GitHub and grabbing the "nvm-setup.zip" file from the Releases section. It's your first step towards becoming a Node.js wizard!  

Install NVM: Unzip the downloaded file and choose a location, say 'C:\nvm'. Now, summon the Command Prompt with administrative privileges, and you're ready to perform the installation magic!  

Setup NVM Environment Variables: Enable the usage of any command prompt with these commands: 

shell
nvm-setup

 

Verify NVM Installation: A true wizard always double-checks their spells. Confirm NVM's presence with the following: 

shell
nvm-version


Install Node.js Using NVM:
The exciting part is installing Node.js versions! For the latest LTS (Long-Term Support) version, utter this spell: 

shell
Nvm install --lts  


Switch Between Node.js Versions:
Time to showcase your true powers! Switch to a specific installed version with: 

shell
nvm use <node_version>   


Set a Default Node.js Version:
Want a default Node.js version across all projects? Easy peasy! Speak this command and install NVM for Windows

shell
nvm alias default <node_version>


How to Install NVM for Linux

Linux sorcerers, this one's for you! Follow these magical steps to wield NVM's power: 

Launch the Terminal: Open your Terminal with a mystical combination of Ctrl+Alt+T or search for "Terminal" in the applications menu.  

Download the Installer Script: Invoke the NVM spirits with the command: 

shell
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash   


Execute the Installation Script:
With the download complete, execute the magical script:

shell
bash install.sh 


Configure NVM: Unlock NVM's full potential by restarting your terminal:

shell
source ~/.bashrc 


Verify the Installation: Ensure NVM has taken root in your realm:

shell
nvm --version


How to Install NVM for Mac:

For all the Mac enchanters, follow these steps to wield NVM's power! 

Launch the Terminal: Summon the Terminal application by pressing Command + Spacebar, typing "Terminal," and pressing Enter.  

Retrieve the Installation Script: Snatch the installation script with this mystical command: 

shell
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash 


Execute the Installation Script: Unleash the magic within the script:

shell
bash install.sh

Configure NVM: Complete the enchantment by either restarting your terminal or using this spell:

shell
source ~/.bashrc


Verify the Installation: Confirm that NVM has taken root in your realm: 

shell
nvm --version

 

There you have it, aspiring Node.js wizards! By following these enchanting steps, you now possess the magic of NVM to manage multiple Node.js versions effortlessly! So, go forth, cast your spells on various projects, and let NVM be your guide in this wondrous world of software development! Happy coding, and may your projects prosper with the power of Node.js!

Need support with Node.js? 

For top-notch software development expertise, Clarion Technologies is here to support you on your journey. With over two decades of experience, we can help your business prosper by providing skilled and accomplished developers. Hire Node.js developers and embrace the power of NVM and let the magic unfold!