How to manage multiple Node versions on Ubuntu 22.04?

Node Version Manager allows you to quickly install and use different versions of node via the command line.

NVM Install & Update Script

$ curl -o- | bash


After running the install script, if you get nvm: command not found or see no feedback from your terminal after you type command -v nvm, simply close your current terminal, open a new terminal, and try verifying again. Alternatively, you can run the following command for the different shells on the command line:

$ source ~/.bashrc

List of installed Node versions

$ nvm ls

Check current Node version

$ nvm current

List available LTS versions of Node.js

$ nvm ls-remote

Install the Node version

$ nvm install <NODE_VERSION>

Select the Node version to use

$ nvm use <NODE_VERSION>

Uninstall the Node version

$ nvm uninstall <NODE_VERSION>

Set Node Version as default

$ nvm alias default <NODE_VERSION>