How to use multiple node versions on the same machine?

Better Stack Team
Updated on March 11, 2024

There are several ways to manage multiple Node.js versions on the same machine. Here are two popular tools for achieving this:

NVM (Node Version Manager):

NVM is a widely used tool for managing multiple Node.js versions on a single machine. It allows you to easily install and switch between different Node.js versions.


You can install NVM by following the instructions on the official GitHub repository.


Once installed, you can use NVM to install, list, and switch between Node.js versions. For example:

# Install Node.js version 14
nvm install 14

# Use Node.js version 14
nvm use 14

Setting a Default Version:

You can set a default Node.js version that will be used when opening new terminal sessions:

# Set default version to Node.js 14
nvm alias default 14

N (Node.js Version Management):

N is another Node.js version manager that simplifies the process of installing and switching between Node.js versions.


Install N by running the following commands:

npm install -g n


Once installed, you can use n to install and switch between Node.js versions:

# Install Node.js version 14
n 14.17.4

# Use Node.js version 14
n use 14.17.4

Listing Versions:

You can list installed versions using:

n ls

Choose the tool that best fits your preferences and workflow. Both NVM and N are widely used and effective for managing multiple Node.js versions on a single machine.

Got an article suggestion? Let us know
Explore more
Licensed under CC-BY-NC-SA

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Make your mark

Join the writer's program

Are you a developer and love writing and sharing your knowledge with the world? Join our guest writing program and get paid for writing amazing technical guides. We'll get them to the right readers that will appreciate them.

Write for us
Writer of the month
Marin Bezhanov
Marin is a software engineer and architect with a broad range of experience working...
Build on top of Better Stack

Write a script, app or project on top of Better Stack and share it with the world. Make a public repository and share it with us at our email.

or submit a pull request and help us build better products for everyone.

See the full list of amazing projects on github