Installing NodeJS and NPM

What is NodeJS

Node.js is an open-source, cross-platform JavaScript runtime environment that can run JavaScript code outside of a web browser.

 

What is NPM

NPM or "node package manager" is the default package manager for NodeJS. It consists of a command line client, also called npm, and an online database of public and paid-for private packages, called the npm registry (https://www.npmjs.com/). NPM registry contains thousands of open packages which allows you to perform different kinds of things inside your application.

 

Installing NodeJS and NPM

METHOD 1

1. Head over to https://nodejs.org/en/ and download "LTS" version of NodeJS which is available for your Operating System. 

2. After you've downloaded the file, follow usual steps to install the application according to your operating system. (double clicking the .exe or .pkg)

METHOD 2 - command line

For MacOS

brew install node

For Ubuntu

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs

 For Arch Linux

pacman -S nodejs npm

 

Verifying Installation

1. Open the terminal and run these commands

node -v
npm -v

2. You should see something like this

 

3. If you can see the versions of node and npm, it means you have successfully installed NodeJS on your machine. Hurray 🥳 

Discussion