Introduction to Node.js and Installation

You might have already heard something about Node.js. It's a very popular runtime environment that has been used extensively for building web applications for quite sometime especially by startup companies. The Node.js community is also growing rapidly.

From the official website, Node.js is an asynchronous event-driven JavaScript runtime built on Chrome's V8 JavaScript engine that is designed to build scalable network applications. It is also an open-source and cross platform runtime environment. The creator of Node.js is Ryan Dahl and is currently maintained by OpenJS Foundation.

You might have wondered why Node.js is so much popular even though it is a single threaded runtime which comes with its own limitations.

  • Well, one of the primary reason for such popularity is the use of Javascript as the programming language. Javascript has been in use for so long time that most of the people in technology sector is already familiar with it one way or the other. Previously, it was in use only in frontend applications and with the introduction and popularity of Node.js, People who were already familiar with the frontend side of the Javascript, they could easily learn and develop applications with Node.js as well.

  • Even though Node.js is a single threaded runtime, because of its asynchronous event drive architecture, it can handle a large number of concurrent requests simultaneously.

  • Another reason is the npm package registry, a default package manager for Node.js which contains hundreds of thousands of libraries which we can use with our projects. Most of the time, whatever the requirements, there is already a package that serves our needs and that helps a lot in the development speed of our project.

  • Node.js is built on Chrome's V8 JavaScript engine, which is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++. Leveraging the power of V8 Javascript engine, which can compile and execute the JavaScript source code extremely fast as well as also efficiently handling memory allocation for objects, and garbage collections of objects it no longer needs.

  • It’s extremely lightweight.

We will talk more on other aspects of Node.js in a later chapters. Let's now install Node.js in our system. If You have already installed Node.js in your system, You can skip rest of the content in this chapter and move to another one.

On macOS

The easiest way to install Node.js in macOS systems is using Homebrew which is a package management system for Apple's Operating System.

Install Homebrew

	/bin/bash -c "$(curl -fsSL"

Install Node.js using Homebrew

	brew install node

On Linux Systems

Ubuntu 22.04 LTS

	sudo apt-get update -y 

	curl -fsSL | sudo -E bash -
	sudo apt-get install -y nodejs

Amazon Linux 2

	sudo yum update -y 

	curl -fsSL | sudo bash -
	sudo yum install -y nodejs

On Windows Operating Systems

To install Node.js on windows system, Browse the following url:

Click on the Windows Installer item and Download the installer file.Once downloaded, Double click on the file and follow the installer prompts.

Install Node.js

To check if Node.js is installed properly or not, Run the following commands:

   node --version
   node -v


To check the installation directory of Node.js

   	which node

To check npm package registry version

   	npm -v
Check Node.js version

In our next chapter, we will install Code Editor and also start using project management system for task tracking.

Prev Chapter                                                                                          Next Chapter