Installing Node.js

tags: Node.js

Linux

In this tutorial, we will show you how to install Node.js and npm on Ubuntu 18.04. Although this tutorial is written for Ubuntu the same instructions apply for any Ubuntu-based distribution, including Kubuntu, Linux Mint and Elementary OS.

Step 1) Start by updating the packages list by typing:

sudo apt update

Step 2) Install nodejs using the apt package manager:

sudo apt install nodejs

Step 3) To verify the installation execute the following command:

nodejs --version
# output
v8.10.0

Step 4) To be able to download npm packages, you also need to install npm, the Node.js package manager. To do so type:

sudo apt install npm

Step 5) Verify the installation by typing:

npm --version
# output
3.5.2

Windows

The first steps in using Node.js is the installation of the Node.js libraries on the client system. To perform the installation of Node.js, perform the below steps;

Step 1) Go to the site https://nodejs.org/en/download/ and download the necessary binary files.

Step 2) Double click on the downloaded .msi file to start the installation. Click the Run button in the first screen to begin the installation.

Step 3) Click Next button several times until installation completed.

Step 4) Restart your computer.

Step 5) To see if Node is installed, open the Windows Command Prompt, Powershell or a similar command line tool, and type

node -v 

This should print a version number, so you’ll see something like this

# output
v0.10.35

Step 6) To see if NPM is installed, type in terminal

npm -v

This should print NPM’s version number so you’ll see something like this

# output
1.4.28