in

happyhappy

Install Node.js on Ubuntu- How to Install on Linux Ubuntu 18.04 LTS & 19.04

How to install node.js, npm package manager and NVM on Linux Ubuntu and Ubuntu based distros using different methods

Install Node.js on Ubuntu: Node.js is a cross-platform and open-source JavaScript run-time environment. It is generally used to run js codes outside the web browser. After the arrival of Package managers(npm) for Node.js, publishing and sharing the source code of node.js libraries became very easy. The vision of Node.js is “Javascript Everywhere” and hence there will be a unified web app development through a single Programming Language rather than following different languages for Server and Client-side scripts. In this article, we will see How to Install Node.js on Linux Ubuntu 18.04 LTS and more using various methods.

Jump to:

Install Node.js on Ubuntu using Terminal- Simple Steps:

Installing Node.js on Ubuntu is very easy. Kindly follow the below steps and execute your JavaScript Codes without the help of any browsers.

Open Terminal on Ubuntu using the shortcut key combination CTRL + ALT + T.

$sudo apt-get update
$sudo apt-get install nodejs
Install node.js on Ubuntu
Install node.js on Ubuntu

The above command will install node.js on Ubuntu. You may be asked to enter the system password to authenticate the installation process and also you will be prompted with Yes or No for continuing the installation process. Kindly press “Y” and press Enter key.

Install npm Package Manager on Node.js Ubuntu:

Now that we have installed the Node.js, it will not be complete without its Package Manager. If you are well aware of Node.js then you will be knowing everything about the indispensability of npm package manager. Kindly use the following command to install the npm package manager for Node.js

$sudo apt-get install npm
Installaing npm manager on node.js Ubuntu
Installing npm manager on node.js Ubuntu

Confirm the prompting “Do you want to continue?” by pressing “Y” will proceed the installation of the npm package manager.

Check this too  How To Install Ubuntu 18.04.2 on Digital Ocean Server Using Putty

How to Check Node.js and npm Versions on Linux Ubuntu:

After installing the Node.js and npm package manager on Ubuntu, you can check their versions using the following commands.

For Checking Node.js Version:

$nodejs -v
Check Nodejs Version
Check Nodejs Version

If you have a number of Node.js Versions installed on your Ubuntu then Kindly use the following command to get the list of them.

For Checking npm package manager version:

$npm -v
npm package manager version
npm package manager version

How to Remove Node.js from Ubuntu:

If you wish to remove Node.js from your Ubuntu, then Kindly use the following commands to uninstall Node.js from Linux Ubuntu.

$sudo apt-get remove nodejs
$sudo apt-get purge nodejs
$sudo apt-get autoremove

How to Install Node.js on Ubuntu using NVM:

This is the alternate method to install Node.js on Linux Ubuntu. We will use Node.js Version Manager. NVM works as a independent directory which allow users to use multiple versions of Node.js without affecting home directory. To make it clear, you able to install Latest Node.js retaining your favourite node.js version. The steps are very simple.

Step 1:

$sudo apt-get update
$sudo apt-get install build-essential libssl-dev

Step 2:

Now that we have the required packages installed, we will download the nvm installation script from corresponding GitHub page.

$curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh -o install_nvm.sh

Step 3:

Nextly, we will check the downloaded installation script with Nano Text Editor on the Terminal.

$nano install_nvm.sh

Now, we will run the installation script with bash so that it will install the nvm on the subdirectory of the Home directory.

$bash install_nvm.sh

Using the Bash on the nvm will also add all the required scripts to the ~/.profile. To update the above changes made and to get the access to nvm, Kindly execute the following command.

$source ~/.profile

Step 4:

It is time to install Node.js. Now that Node.js Version Manager(NVM) is installed, we will select the nodejs versions to install and to use. The following are the commands.

$nvm ls-remote

From the list of Node.js Versions, you can choose the particular version to install.

$nvm install N.N.N
Note: Replace N.N.N with the required Node.js version

How to Check Node.js Version on Node.js Version Manager(NVM):

The command to check the Node.js version varies when you use NVM. The following is the command to check the Node.js Version on NVM.

$node -v

We have installed Node.js using NVM. You can start using now.

Check this too  How to Install & Use Docker on Ubuntu 18.04 LTS Bionic Beaver

Get in Touch with Us:

This article provides detailed information on How to Install Node.js on Ubuntu using the direct method and also using the Node.js Version Manager(NVM). This article also discusses checking the Node.js and npm Package manager versions on direct method and as well as on the NVM. If you have any Query then Kindly Comment Us and we will revert to you with a solution ASAP. For instant solutions, Contact Us through our Forum!!

 

  • Article Quality
  • Author Rating
  • Explanation
  • Efficiency
4.5

Summary

For more interesting articles, Kindly visit Tec Robust

Sending
User Rating 1 (1 vote)
Comments Rating ( reviews)

Leave a Reply

Your email address will not be published. Required fields are marked *

Sending

Written by Julian

Hello Folks! I'm Julian, Promoted to the Content writer for the category of Commands & Web Apps in Tec Robust. Enjoy my content & Learn more Linux Commands!

Contact me:
tecrobust [@] gmail.com
Sub: Message to Julian

TMUX Command Sheets

TMUX Commands & TMUX Cheat Sheet List {2019} Updated!

LibreOffice Ubuntu

LibreOffice Ubuntu: How To Install LibreOffice for Ubuntu 18.04 LTS and 19.04