DEV Community

Cubite
Cubite

Posted on

How to install multiple node versions on the same machine

Our headless CMS, Strapi requires node version <= 14.x.x and we had node version 15 installed in our development machine. So that brought a question to my mind, is there a way like python venv for node to install different versions in the same machine. After doing a quick investigation, I found nvm node version manager that lets you have different versions of node on the same machine and switching between them.

How to install

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

Enter fullscreen mode Exit fullscreen mode

or

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

Enter fullscreen mode Exit fullscreen mode

To verify installation run nvm --version

List and Install node versions

To list available versions, you can run

nvm ls-remote
Enter fullscreen mode Exit fullscreen mode

To install specific version you can use nvm install VERSION for example

nvm install 12.18.4
Enter fullscreen mode Exit fullscreen mode

Switch between different versions

You can use nvm use to switch to a specific version. For example

nvm use 12.18.4
Enter fullscreen mode Exit fullscreen mode

Top comments (0)