What are Nodejs and npm- Installation and overview

It is pretty evident that JavaScript has evolved over the years. From a language that was used with HTML to make rich front-end pages, to a language that everyone speaks and understands.
Unless you have been living under a rock, you already have heard of nodejs. With the node platform, JavaScript has evolved into so much more.

What is Node js?

Nodejs is a runtime environment that runs chrome’s V8 engine under the hood. Node lets you compile and run JavaScript code outside web browsers. This has significantly increased the number of uses for JavaScript. Today, JavaScript is used in creating web apps, desktop apps, mobile apps and almost every niche you can imagine.

What is NPM?

NPM is short for Nodejs Package Manager. It is a small tool that lets you download and install JavaScript libraries and packages. It is basically a dependency manager for Nodejs apps. It comes by default with a fresh installation of node on any system. Apart from NPM, yarn is another package manager that can be used with node. However, yarn doesn’t come with node and you need to install it separately.

Installing Node and NPM

Node is highly cross-platform and is available for many operating systems. The source code is open source and binaries are available for Windows, Mac, Linux, and Sun operating system. Additionally, a docker image is also distributed for use with docker container apps.
There are 2 major versions of Node currently available.

  1. Node v8.12 with NPM v6.4.1 is the current stable and LTS release of node.
  2. Node v10.10 with NPM v6.4.1 is the latest Non-LTS release.

As a beginner, It is suggested that you use the LTS release since a lot of packages are built specifically for LTS releases. The newer releases have experimental features that are not yet stable. Installation for Windows and Mac is pretty simple. You just need to download the binaries from this page and keep following the instructions.
For Linux and other systems where package managers like apt, yum etc are used, installation instructions are available here.

Using NPM

Whenever you work on a Node project, it is suggested that you initialize it. Initializing a Node project is fairly easy. CD into your project folder and run npm init. You will be asked a few questions about the project like its name, description, author etc.

Congratulations, you have just initialized an npm project. You will now have a package.json file in your project directory with a similar structure. This is JSON representation of your project details.
 "name": "theitstuff",
 "version": "1.0.0",
 "description": "",
 "main": "index.js",
 "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
 "author": "Rishabh Kandari",
 "license": "ISC"
Now it is time to install some libraries made by other people. To do this, we will be using the npm install command. Let’s install the momentjs library by running the following command.
npm install moment
Now, before we go ahead, I want you to peep into your project folder. It should have the following structure by now.

You have a new package.lock.json file and a folder called node_modules. This folder houses all the libraries you have installed for this project. To uninstall the same library you can run npm uninstall moment. To list all dependencies of your project, run npm list. A full list of available commands can be viewed on running npm --help.


Nodejs has really changed the way people see JavaScript. It has become a fully fledged language supporting the infrastructure of some of the biggest software products out there. People love it for its simplicity, availability, and ease of use. I hope you are now clear with Nodejs and NPM. If you have any doubts regarding anything, do let me know in the comment section below.

Read more