DEV Community

loading...

Install node using NVM in under 3 mins

naseelniyas profile image Naseel Niyas ・2 min read

Hey There!🙋‍

This article is about installing Node on a Unix/Linux based system. We are using NVM to do this

You can also follow this video by me....(Don't forget to subscribe!)

This guide can be followed on: > 1) Linux based distributions like Ubuntu, Debian, Red Hat, Fedora > 2) Unix distros MacOS ... etc.

Step 1

Visit https://github.com/nvm-sh/nvm to visit nvm's github repository Image "Nvm github"

Now we can scroll down untill we find a list of commands Installation commands

Step 2

Now, we just have to run these commands.

Command 1: Use curl/Wget to run the Install/Update script.
Using Curl:


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

Using Wget:

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

We have to export some ENV (Enviornment variables)... Run these 2 commands


export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"

sh [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

Step 3

Use NVM to install Node!

Now we have successfully installed NVM. Time to use It.

To install the latest LTS version of node, run:


nvm install --lts

To install latest version of node, Run:


nvm install node

To install a specific version of node, run:


nvm install 12.0.0 # This istalls node v12.0.0

To use a specific version:


nvm use 12.0.0 # Uses node v12.0.0

That's It! Now you have node running on your system!


Encountered an error? Comment below!

Discussion (0)

pic
Editor guide