Node.js (Node) is a popular JavaScript runtime that evolves rapidly. Managing different Node versions for various projects can be a hassle. Enter Node Version Manager (NVM), an open-source tool that simplifies the process. In this guide, we’ll walk you through installing NVM.
Advantages of NVM
- Version Management Made Easy: NVM streamlines the process of switching between Node versions, making it a breeze to test compatibility and upgrades across multiple projects.
- User Directory Storage: No more need for ‘sudo’ commands; NVM stores Node versions and modules in your user directory.
- Simplified Installation: With NVM, you don’t have to obtain Node versions directly from the distribution channel.
Installing and Configuring NVM
Step 1: Install NVM
You can install NVM on most Linux distributions with a single command using either curl
or wget
:
Using curl:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
Using wget:
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
Remember to source the newly added instructions in .bashrc
to make NVM functional. You can either restart your shell or manually source .bashrc
:
source ~/.bashrc
Step 2: Confirm NVM Installation
To verify a successful installation, run:
command -v nvm
You should see ‘nvm’ if the installation was successful. If not, make sure to source the .bashrc
file again.
Step 3: Check NVM Version
Confirm the NVM version with:
nvm --version
Conclusion
Node Version Manager (NVM) is an invaluable tool for managing Node.js versions with ease. Whether you’re developing multiple projects or need to switch between Node versions regularly, NVM simplifies the process, making it a must-have for any Node.js developer. Happy coding!
One thought on “How to install Node Version Manager”