This tutorial will help you to install NVM on Ubuntu 18.04 LTS (Bionic) system. Tutorial will also help you to install mutiple node versions on a account on Ubuntu system.

Prerequisites

A running Ubuntu 18.04 LTS system with shell access Login to system with user to which you need to install Node versions

Install NVM on Ubuntu

A shell script is available for the installation of NVM on Ubuntu 20.04 Linux system. Open a terminal on your system or connect remote system using SSH. Use the following commands to install curl on your system then run NVM installer script. The NVM installer script create environment entry to login script of current user. You can either logout and login again to load the environment or just execute below command to do the same.

Install Node.js using NVM

You can install multiple Node.js versions using nvm. And use required version for your application from installed Node.js. Install the latest version of Node.js. Here latest is the alias for the latest node version. To install a specific version of node: You can choose any other version to install using above command. The very first version installed becomes the default. New shells will start with the default version of node (e.g., nvm alias default).

Useful NVM Commands

You can use the following command to list installed version’s of Node for the current user. With this command you can find available Node.js version for the installation. You can also select a different version for the current session. This will be current active version for current shell only. To find the default Node version set for the current user, type: You can run a Node script with the desired version of node.js using below command:

Conclusion

This tutorial helped you to install nvm on Ubuntu 18.04 LTS Linux system.