Learn How to Install Nodejs and npm on Ubuntu

learn how to install node.js and npm on ubuntu

Introduction:

Nodejs:

Node.js is a free and open source cross platform javascript runtime that was built on chromes javascript engine. It is commonly used for developing server side Web applications. We can build fast and Scalable applications with node.js

Npm:

Npm is a package manager for javascript. It’s a default package manager for Nodejs. Npm is the largest registry in the world.

Begin Node.js and npm installation:

In this tutorial we are going to learn how to install Node.js and npm on Ubuntu 16.04/18.04.

We can install Node.js and npm on ubuntu 16.04/18.04 by following methods:

Install Node.js and npm from nodesource:

At the time of writing this article 10.x, 12.x are the active LTS versions of Node.js and 13.x, 14.x are the current latest versions of Node.js.

choose the version of Node.js you want to install, then add the PPA to your Ubuntu machine by the following versions.

Nodejs 10.x LTS version:

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -

Nodejs 12.x LTS version:

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -

Nodejs 13.x current version:

curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -

Node 14.x current version:

curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -

In this tutorial installation steps are based on 14.x current Node.js version. Let’s begin the installation of Node.js and npm on Ubuntu 16.04/18.04.

curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -

After adding PPA from NodeSource, then install Node.js and npm on ubuntu.

sudo apt-get install nodejs

This package includes both node and npm.

Check Node.js and npm version:

Node.js version:

To check the installed version of node:

node -v
Output:
v14.1.0

Npm version:

To check the installed version of npm:

npm -v
Output:
6.14.4

Install Node.js and npm from Ubuntu repository:

Node.js and npm are available on Ubuntu’s default repository. Install Node.js and npm on your machine by executing following commands:

Install Node.js:

sudo apt-get update
sudo apt-get install nodejs

Install npm:

sudo apt-get install npm

Check Node.js version:

To check installed version of Node.js:

nodejs -v

Conclusion:

That’s all we have successfully installed Node.js and npm on ubuntu 16.04/18.04 server. Let’s start to build your application.

Exit mobile version