How to Install Node.js on Mac ? Step by Step the Easy Way

In this tutorial, I will cover How to Install Node ?

Welcome to Mrvirk.com, I am your host Navjot Singh and I will be responsible for guiding you in this tutorial.

Install Node

Video Tutorial

1- To install node, visit nodejs.org and go to the downloads page – https://nodejs.org/en/download/

2- Download Node based on your operating system – Mac, Windows PC, Linux or others.

In this tutorial, I will be installing node on a Macbook Pro. The steps for other platforms may differ slightly based on the platform.

3- Install Node using the pre-built installer

Check if I have Node Installed

To check if you have, Node installed on your machine –

Open Terminal (Mac) or Command Line (Windows PC) and run the command below –

node -v

If the command runs successfully, it means Node is installed and it will also return the version of Node installed on your machine, and if it fails it means Node is not installed.

Check the version of npm

To check the version of npm installed on your machine, simply run the command below –

npm -v

Running a JS file using Node

Create a Javascript file, for this example we will be consoling a message.

Use the keyword “node” and the file name as seen in example below (and dont forget to change directory to where your JS file is located)

node name_of_your_file.js

Below is the code file covered in the video tutorial for quick reference.

console.log("Congratulation! Node is currently installed in your computer");
console.log("Yeah I did it");

/*

1- How to install node

2- Checking the if node is installed and its version
node -v

3- Checking the version of npm
npm -v

4- Running a JS file using Node
node name_of_your_file.js

5- Upating Node
sudo npm cache clean -f 
sudo npm install -g n 
sudo n stable 

6- Installing a package using npm 

7- Installing a package using bower

*/

Updating Node

To update node on your machine, run the commands below –

sudo npm cache clean -f 
sudo npm install -g n 
sudo n stable 
Navjot Singh Virk
Navjot Singh Virk

Navjot is a Hobby Blogger from Ireland and loves to create content to help people. He makes time on weekends to work on this blog. And has a full time position at Workday as Technical Product Manager, which he loves and thrives at.

His Skills include in-depth knowledge of SEO, Javascript, Advertising, HTML, Java and Product Management. And his other hobbies include Investing, Gardening and playing Table Tennis.

Articles: 52