Installing Multiple Versions of Node.js on Ubuntu Using NVM

To be able to switch between node and npm versions on one local machine, we need to use the nvm (Node Version Manager) program.

Installation

Up-to-date information on the repository https://github.com/nvm-sh/nvm

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

chmod +x ~/.nvm/nvm.sh

source ~/.bashrc

Check (must be version 0.40.0)

nvm -v

Check local (installed) versions of Node

nvm ls

Check existing versions of Node (available for download)

nvm ls-remote

Download and install the desired version

# Install LTS version 18

nvm install 18

# or install this version

nvm install 17.9.1

# or install the latest LTS version

nvm install node

Activate the desired version

nvm use 18

Make some version default

nvm alias default 18

Source 1, Source 2

1016 0

Comments

Be the first to review this item. Share your rating and review so that other customers can decide if this is the right item for them.
You have to log in to leave a comment. Sign in

Similar articles