Home » What is NVM used for?
What is NVM used for?

What is NVM used for?

Introduction:

Node Version Manager (NVM) is a Javascript developer tool for managing the Node.js version. In this blog, we will learn what NVM is and how to install it on Windows and MCA Systems.

What is NVM?

Node Verison Manager(NVM) is an open-source command-line utility for managing multiple Node.js versions in a single system. Developers can easily install, uninstall and switch the node.js version of their project requirements.

Purpose of NVM:

NVM is a Non-Volatile Memory. NVM refers to a type of computer that retains stored data when the computer is switched off. It is typically used for secondary storage or long-term storage. It is not good for primary storage because of its higher cost and lower performance.

How to install NVM in Windows?

NVM mostly supports Mac or Linux Systems. It does not support Windows Systems. However, Corey Butler created a solution to provide its experience on Windows systems.

NVM comes with a management utility to manage different node.js versions in Windows.

Go to NVM-windows Git Repository. Click this link, and you will be redirected to the GitHub repository. Then click the nvm-setup.exe file, and your file will be downloaded.


Go to download and double-click the .exe, and open this exe file.

Setup run


Click the run button, then permission to access the nvm.exe in your system.

Agreement Access image


Accept the agreement and click the next button.

Select folder image


Select the folder where the NVM setup will be installed.

NVM floder select image


Node.js is installed in this path. If you have to change it, you will change the path, and the node.js environment path will automatically be set up. Then click the next button.


Then click the install button, and NVM install in your system. Check the installed version of NVM, open the Command line and enter the nvm -v

nvm Output


Now, make sure node.js is available in your system. If not, download it from their official website and install it in the system. Then open cmd and check their version of node and npm.

NVM cmd image


Using this command, we can check how many nvm versions we have installed in our system.

NVM list command


How to install NVM in mac and Linux?

Mac and Linux are similar. Both are UNIX-based operating systems. So it’s a similar way to install nvm.

Execute the below command to install NVM:

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


OR

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


Mac image:

Cmd image for mac


OR
Linux image:

Install nvm



This command will clone the nvm repository to a ~/.nvm dictionary on your System.

This script contains instructions on where to install the nvm in the system.
This nvm repository will be cloned to the .nvm directory in your system and the below command to either of the profile configurations: ~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc.

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm


Now, when we are done installing the NVM, we can verify that the installation was successful and that the NVM is available globally in our system.

nvm -v


Mac Image:


OR
Linux Image:

install Ubuntu


Let’s install node.js using nvm.

We can install a particular node.js version using nvm using this command:

nvm install 14.21.3


Mac Image:


OR
Linux image:

Linux images inatsll nvm



When we use the node.js 14.21.3 version, we have to run this command:

nvm use 14.21.3


Mac Image:

nvm use node.js version image


OR
Linux Image:

nvm use


How to uninstall node.js?

If we have any nodes.js version that is not used so, how to uninstall using this command:

nvm uninstall 14.21.3


Mac image:

Uninstall node,js


OR

Linux image:

nvm uninstall


This command removes node.js 14.21.3 version.


Conclusion:


In this blog, we learn what nvm is and how to use Windows, Mac and Linux systems. Then, we learn how to switch between different node.js versions using nvm, how to use the node.js version using nvm, and how to uninstall the node.js version.

FAQ:

What is NVM and why it is used?

NVM is a node version manager. It manages different node.js versions in a single system, and you can switch the version according to your project requirements.

What is difference between npm and NVM?

The difference between npm and NVM is that npm is a package manager used for managing Javascript packages, while NVM is a version manager used for installing and managing different node.js versions in a single system.

Where can I use NVM?

When you are managing multiple projects, but the project node.js version is different at that time, NVM is useful.

More Reading

Post navigation

Leave a Comment

Leave a Reply

Your email address will not be published. Required fields are marked *