Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Installing NodeJS in Ubuntu

Install nvm

nvm - Node version manager is probably the most effective means to install and manage Node.js installations in linux environment. It provides ways to have multiple node versions installed in a machine and abilities to switch between versions. Install a particular version of nvm using either curl or wget. Just change the version number to get the specific version of nvm.

Using curl

curl -o- | bash

Using wget

wget -qO- | bash

Install Node.js

You can install a particular version of Node.js by using the following command. For eg. to install Node.js 10.16.3,

nvm install 10.16.3

You can also install the latest lts version of Node.js

nvm install --lts

Switch between multiple versions

You can switch between multiple node versions by specifying the target node version in nvm use command.

nvm use 12.16.2

You can also set the default Node.js version by creating an alias and using it

nvm alias default 12.16.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment