Installing Node.js Ubuntu
The easiest way of installing node.js on Ubuntu is via NVM. It allows you to quickly install and use different versions of node.js via the command line.
Installing
To install node.js on Ubuntu:
1. Install nvm using the following command
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
or
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
2. Install node.js using nvm
nvm install 15--lts
Note: The above command installs node.js version 15
3. Verify the correct version of node.js has been installed
$ node -v
v15.14.0
$ npm -v
7.7.6