Install Node.js using Node Version Manager

Node Version Manager is a tool that helps us install and manage all the Node.js versions that we have installed on our machine. In this tutorial, I will guide you how to install and use this tool!

Node Version Manager can run on unix, macOS, and Windows WSL with some important notes, you can see more here. In this tutorial, I will work with Node Version Manager on macOS only!

Install Node Version Manager

To install Node Version Manager, you can download the installation script at and install it by executing this file.

Another way is that you can also use the curl command as follows to download and install it:

By default, Node Version Manager will be installed in the “<user_home>/.nvm” directory. You can change this default directory by declaring the NVM_DIR environment variable pointing to the directory where you want it to be installed!

My example is as follows:

Now, run the curl command above, you will see the same result as me, as follows:

At this point, Node Version Manager has been downloaded and installed in the /Volumes/Passport/softwares/nvm directory on my machine.

During the installation, a configuration was added to the .bash_profile file:

to export environment variables so we can use Node Version Manager anywhere on our computer with that command line!

You can run the command “. .bash_profile” to make the above configuration take effect immediately with the Terminal you are opening or close this Terminal and open another Terminal to start using Node Version Manager!

The result when I check the installed Node.js versions using the command:

of Node Version Manager on my machine as follows:

So we have successfully installed Node Version Manager!

Install Node.js

To install a version of Node.js with Node Version Manager, first, you can use the command:

to check all the versions of Node.js that we can install.

My results are as follows:

We can install any version of Node.js.

You can use the command:

to install the version of Node.js you want.

For example, I installed the latest version at the time I wrote this tutorial, v22.3.0, as follows:

Node Version Manager will automatically download the Node.js version you want to install to the $NVM_DIR/versions/node folder and install it for us.

Now you can check the results using the command:

My example is as follows:

Node Package Manager is also installed:

So we have successfully installed Node.js using Node Version Manager!

Add Comment