How to Install Node.js and NVM on an Ubuntu Cloud Server?

05-02-2024 02:02:55

Node Version Manager (NVM) allows the installation and switching between multiple versions of Node.js through the command line. This guide is based on an Ubuntu 20.04 cloud server and introduces the steps for installing and using Node.js and NVM.

After remotely logging into the system, NVM can be installed with a single command.

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

Check the version of NVM.

$ nvm -v
0.38.0

Once NVM is installed, you can use this tool to install Node.js.

$ nvm install node

The above command installs the latest version of Node.js. To install a specific version of Node.js, simply add the version number.

$ nvm install 6.14.4

After successful installation, check the version of Node.js.

$ node -v