Node.js Environment Setup

It’s very easy to setup and configure Node.js Environment on your local machine. There is 2 main software you would require to install to start working on Node.js. The first one is Node.js Software itself and the second thing is the editor to build and run the Node.js code. In this tutorial let’s take a look in detail on Node.js Environment Setup in different Operating systems.

NodeJS Installation Video Tutorial

Installing Node.js and npm on Windows Operating System

#1. Download the Node.js windows installer from the Official Node.js website.

#2. Run the installer file basically, the .msi package which you downloaded from Node.js website.

#3.  Make sure that all the features like Node.js runtime, npm package manager and Add to Path is selected in the installation wizard, if not click on the arrow and select entire feature will be installed option and click on next to continue installation.

#4. Restart your computer once the installation is finished. You will not be able to run Node.js unless you restart the computer.

Installing Node.js And Npm On Windows Machine
Installing Node.js and npm on Windows machine

Installing Node.js and npm on Mac

Installing Node.js and npm on mac machine is not as straight forward as we did for a windows machine. The user must also have a basic understanding of the Mac terminal application. We need to run a set of commands on the Mac terminal to install node.js and npm.

Node.js Prerequisites

Before you start installing Node.js and npm on OSX you would require two other applications which are listed below.

    1. XCode – Apple XCode is a development software which is used to build, compile and run iOS apps. XCode is free and you can install it from Apple App Store.
    2. Homebrew – Homebrew is a package manager for the Mac, we can install most of the open source software using simple commands. To install Homebrew on Mac, open the terminal and paste the following command in the terminal window.
      /usr/bin/ruby -e "$(curl -fsSL"

Installing Node.js using XCode and Homebrew

Installing Node.js using Homebrew is very simple, Homebrew takes care most of the things like Downloading, Unpacking, Installing Node and NPM on your system. It should not take more than 5 mins to install node.js

#1. Make sure you have the updated version of Homebrew. Open the terminal window and type the command brew update to update the homebrew.

#2. To install node.js in the terminal window run the command brew install node

#3. Wait for few minutes, Homebrew will download, unpack and install the node.js on your machine.

#4.  To verify the Node.js installation, type the command node -v in the terminal. You should get the version no of the node in the terminal window.

Install Node.js on Ubuntu

There are multiple ways to install Node.js on Ubuntu. We will see 2 efficient ways to install node.js on Ubuntu.

Install Node.js with Ubuntu Package Manager

#1. Open the terminal window and type the below command.

sudo apt-get install nodejs

#2. Once the installation is finished, next step is to install the Node Package manager. To install npm run the below command in the terminal.

sudo apt-get install npm

#3. Create a symbolic link for node, many of the node.js tools use this name to execute. Run the following command in the terminal to create a link.

sudo ln -s /usr/bin/nodejs /usr/bin/node

#4. To test the Node.js and npm on your machine run the following commands shown below inside the terminal.

$ node -v
$ npm -v

Another alternative way to install Node.js on Ubuntu or Debian is by using the curl command.

Install Node.js version 4.x on Ubuntu or Debian

Open the terminal and type the below commands

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

Install Node.js version 6.x on Ubuntu or Debian

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

To compile and install native addons from npm you may also need to install build tools. Run the below command to install the addons.

sudo apt-get install -y build-essential

If you are using any other Linux and if you want to install Node.js check out the Official Installation Guide of Node.js

Leave a Reply

Your email address will not be published. Required fields are marked *

Sign Up for Our Newsletters

Subscribe to get notified of the latest articles. We will never spam you. Be a part of our ever-growing community.

You May Also Like