Sitemap

Installing Node.js using NVM: A Step-by-Step Guide

2 min readSep 18, 2023

--

Node.js is a cross-platform, open-source server environment that can be run on any machine. This lets developers run JavaScript outside the web browser. For the effective management of different versions of Node, the Developer uses Node Version Manager. In the article, we will walk through the process of installing Node.js using NVM

Step 1: Installing NVM
The first step is to fetch NVM from the specified URL

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh

Alternatively, we can have a single command installation by running the following command:

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

Step 2: Configuring the NVM
Once, NVM is downloaded, we need to configure it by sourcing the shell profile. This will enable NVM to work with a shell environment.

source ~/.bashrc

Step 3: Listing Available Node.js versions
Now, that our NVM is totally set up, we can view the available Node.js version with the following command. This will list down all the Node.js versions we can install.

nvm list-remote

Step 3: Installing a Specific Node.js Version
To install a specific Node.js version, use the following command, replacing v18.12.1 with your desired version:
This will install the specified Node.js version in your system.

nvm install v18.12.1

Step 4: Using the Installed Node.js Version
The system may have multiple versions of Node.js installed on the local machine. We can activate it by running the following command on the terminal:

nvm use v18.12.1

This command activates the selected version of Node.js, allowing it to work on the current terminal session.

In Conclusion, NVM helps in the management of Node.js versions making it easy to work with different versions and switch between them.

--

--

Sashesh Singh
Sashesh Singh

Written by Sashesh Singh

I am a skilled software developer with expertise in Python, FastAPI and Django.