Skip to content

Instantly share code, notes, and snippets.

@sampathBlam
Created April 24, 2020 09:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save sampathBlam/85beb80dbaa9f0bdba75fde188e32102 to your computer and use it in GitHub Desktop.
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- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

Using wget

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | 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