paint-brush
How to install Node.js on Ubuntu 16.04/18.04 using NVM (Node Version Manager)by@jagtap.vishal30
50,419 reads
50,419 reads

How to install Node.js on Ubuntu 16.04/18.04 using NVM (Node Version Manager)

by Vishal JagtapJanuary 28th, 2019
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

NVM is basically the version manager for <a href="https://nodejs.org/en/about/" target="_blank">Node.js</a>. With the help of NVM we can install and use multiple versions of Node.js along with NPM. If we have multiple Node.js projects having various versions of node and npm then always install node using NVM only.

Company Mentioned

Mention Thumbnail
featured image - How to install Node.js on Ubuntu 16.04/18.04 using NVM (Node Version Manager)
Vishal Jagtap HackerNoon profile picture

Introduction

NVM is basically the version manager for Node.js. With the help of NVM we can install and use multiple versions of Node.js along with NPM. If we have multiple Node.js projects having various versions of node and npm then always install node using NVM only.

Installation of NVM

First download the NVM installation script using cURL as follows

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

After downloading the script, run the script using bash as follows

$ bash install_nvm.sh

To reflect the changes for the current user session, use following command

$ source ~/.profile

Check installed NVM version as follows

$ nvm --version

Use following nvm command to list all available node.js versions

$ nvm ls-remote

It shows the output as follows

Install particular node version using following nvm command:

$ nvm install 10.15 # it will install node 10.15.0

To see all installed node version, use nvm list as follows:

To use particular node version use

$ nvm use 10.15 # it will use node 10.15.0

To check node and npm version, use following commands:


$ node -v$ npm -v

Conclusion

Now successfully installed the Node.js and npm using NVM. It will be very useful to manage the various nodejs projects having different node versions. Hope this guide help you in installation of node in ubuntu environment.

Thank you!!!