Manage Node versions with NVM.
Tags: node, javascript, beginners, webdev
Published: 2023-09-10 02:48:43

## Introduction:

When working with Node.js, you might need to install multiple versions of the runtime.

But, Managing node versions can be tricky for many developers!

Don't Worry!

In this Blog, I will guide you on how to install and manage different node versions with NVM.

### Prerequisites:

1. [Install Node.js](https://youtu.be/JINE4D0Syqw)
    
2. [Install Node Version Manager](https://www.freecodecamp.org/news/node-version-manager-nvm-install-guide/)
    

## What is NVM?

NVM stands for Node Version Manager. It's a command line tool that helps us to manage and switch to different versions of Node.js.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689924930606/eea621ab-2935-4d36-ad7d-c7257077ddd7.png)

## **Managing Node versions with NVM**

#### **1.Check Available Node versions:**

Before Installing any node version let's check the available Node versions. To check available versions, Run the following command in your command prompt:

```bash
nvm ls available
```

After running this code, You will get the following results:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689884660139/c1506f41-1961-442c-bf0a-014781e9c3e5.png)

#### **2.Install Multiple Versions of Node.js:**

One of the most important parts of nvm is installing different versions of Node.js.

For this, nvm provides the `nvm install` command. You can install specific versions by running this command followed by the version you want. For example:

```bash
nvm install 12.14.1 
```

> Tip:
> 
> nvm follows [**SemVer**](http://semver.org/), so if you want to install, for example, the latest `12.14` patch, you can do it by running:
> 
> ```bash
> nvm install 12.14
> ```
> 
> Here, '`12`'represents Major Version & '`14`' represents Minor Version.

#### **3.Install the Latest Version of Node:**

To install the latest version of Node, Run:

```bash
nvm install latest
```

<div data-node-type="callout">
<div data-node-type="callout-emoji">💡</div>
<div data-node-type="callout-text">Tip: It is always better to install the long-term support (LTS) version of Node because it is less buggy.</div>
</div>

> To install the LTS version of Node, Run:
> 
> ```bash
> nvm install lts
> ```
> 
> After that you'll get :
> 
> ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689885707513/9e558755-4eb9-48a2-87c7-fac788e90cef.png)

#### **4.Install specific Node Version:**

To install that specific version, Run:

```bash
nvm install node-version-number
```

Replace the \`node-version-number\` with your desired Node version.

Once you install a version of Node, the corresponding version of NPM is installed for you. So you don’t need to install NPM separately.

#### **5.Uninstall Any Instances of Node:**

To uninstall any instance you no longer think is useful, by running:

```bash
nvm uninstall node-version-number
```

#### **6.See Installed Node Versions:**

To see the list of Node versions you have installed on your Windows machine, run:

```bash
nvm list
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689886505723/9152bada-7aac-411f-a4d4-7deb33c73722.png)

#### **7.Switching Versions of Node:**

As you can see in the previous image that I'm currently using `18.16.1`

If you want to switch your version to another version (eg. `18.17.0`)

Use the Following Command:

```bash
nvm use 18.17.0 //replace the version number with your desired one
```

To use a specific version of Node, run:

* `nvm use latest` to use the latest version
    
* `nvm use lts` to use the long-term support version
    

These are some processes to manage Node versions.

## Conclusion:

If you found this blog post helpful, please consider sharing it with others who might benefit. You can also follow me for more content on Tailwind CSS and other web development topics.

To sponsor my work, please visit: [https://arindam1729.hashnode.dev/sponsor](https://arindam1729.hashnode.dev/sponsor) and explore the various sponsorship options.

Connect with me on [Twitter](https://twitter.com/intent/follow?screen_name=Arindam_1729), [LinkedIn](https://www.linkedin.com/in/arindam2004/), [Youtube](https://www.youtube.com/channel/@Arindam_1729) and [GitHub](https://github.com/Arindam200).

Thank you for Reading :)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1688125007877/f3d5d31f-d473-44a8-9af3-3839cd538dda.png)