What is Node JS?

So Node js is a run time environment for javascript before we dive into Node js lets us understand How does our Javascript work? Javascript works in the browser because of javascript Engine like in chrome browser we have a V8 engine, in Firefox spider monkey is present. So the main challenge is how we can run the javascript outside the browser. Then there was a scientist named Ryan Dahl who developed Nodejs what he did that he took V8 Engine and embed it with C++ and this project is called Node Js. So node js is not a library or not a framework it is a runtime environment for javascript.

how to install nodejs in mac

How Node Js Works?

The Most important topic is how node js works. Let us explain by an example When a client creates a request then that request goes to the event queue and then all request will go To the event loop , the event loop is a kind of loop that always keep an eye on an even queue for Request and all requests will be handled by event loop by FIFO principle (first in first out) Means client 1 will request and his request will be handled first and he will get the response. So when the event loop picked the request it will observe that these requests can be of two types Blocking and Non-Blocking Request. If a Non-blocking request is picked then it will be processed and a response will be sent but when a Blocking request is picked then it will go to Threadpool, now the question is what is Threadpool? A thread pool is a kind of pool in which all workers are there and the thread pool will find the workers and assign the worker for the request .

Install Node Js 

To install node js navigate through the https://nodejs.org/en and download it.

Install Node Js By NVM

What is NVM ?

it is called a node version manager it is open source by which developers can switch the node versions on their machine and according to their project requirements.

Step-by-Step Guide to Install NVM on Mac OS

Step 1: Install Homebrew

/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)”

Step 2: Install NVM and Add nvm to your shell profile

brew install nvm source $(brew --prefix nvm)/nvm.sh

Step 3: Verify NVM Installation

nvm --version

Step 4: Managing Node.js Versions with NVM

nvm install --lts
nvm ls
nvm use 14.15

Conclusion - How to install nodejs in mac

In the above article, we explore what is node js , how nodejs works, and its installation 
In simple words nodejs is run time environment for javascript it was developed by Ryan Dahl and embedded in the C++ and v8 engine and this project is called Nodejs.
You can install nodejs on its official website or by nvm following the above steps.