How to Install node js on Windows, Mac and Ubuntu

By Patmos Zen •  Updated: 03/14/17 •  5 min read

Node.js is a JavaScript based platform built to be a cross-platform run time application that runs various backend server tools and application. It has capabilities beyond the scope JavaScript is known for, built on Chrome’s V8 JavaScript engine. It uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

Node.js is also used to build scalable application that does more than rendering client side application but also server side functionality that makes building application faster. Node.js is an open source application, built by Ryan Dahl.

Installing Node.js

Installing node.js on different operating system requires steps and process applicable to each of the OS, been a cross platform application it runs smoothly on all major operating system.  The focus for this guide will be limited to installing node.js on Windows, Mac, Ubuntu and by extension Linux operating system.

Knowing how to work with node.js, especially using it to persist data and creating API’s with it can easily make a front-end developer became a fullstack developer. Node.js is awesome and has so many cool capabilities beyond the scope of this guide.

Installing Node.js on Windows

As at the time of writing this guide, Node.js has two version for Windows (X64) and (X32), a node.js version recommended for most users on version V6.10.0 LTS and another with the latest features V7 .7.2. The version with the latest features may contain bugs, so it is advised you stick to the stable version.

The following below are the steps need to install node.js on windows:

  1. To install you need to open your command prompt also known as cmd. Alternative to this is to use gitbash. Download GitBash here. Preferred if you use command line prompts.
  2. If you do not have git bash you can download from the link above and run it.
  3. Then download Node Package Manager – NPM, which installs and manages the Node Modules.
  4. Run the executable file and follow the instruction to install it on your device.
  5. It is important you accept the license terms and select the default installation settings. Amend if you have special requirement or preference.
  6. Once download is complete, it will be inside the windows program directory, you can search for it using the search tool or going through the installed program.
  7. Restart your system to complete the installation cycle.

Still to come below, you will find instructions on how to uninstall node.js, upgrade node.js and check the version you are currently running using a command line.

Installing Node.js on Mac

To install node.js on your Mac OS, you need to understand the use of Mac Terminal application, this will allow you to write commands to be executed by the machine. However one thing the official node.js download site does is that it detects the operating system you use and offers you the download based on system specification.

  1. Go to Node.js official site
  2. Your operating system will be auto-detected, choose and click the stable version.
  3. Run the application following the instruction on the installation wizard
  4. Accept or agree to the license
  5. Once installation is complete.

If you are unsure of the download location, you can visit the node.js download page.

To install node.js via a package manager.

Simply download the Macintosh Installer direct from the nodejs.org web site.

If you want to download the package with bash:

Using Homebrew:

  1. brew install mode

Using MacPorts:

Using pkgsrc:

Install the binary package:

Or build manually from pkgsrc:

 

Installing Node.js on Ubuntu, Linux Centos and more.

Though node.js is built on Chrome’s JavaScript run-time, it has a strong association with Linux.

You can download the Linux Binaries (x86/x64), Linux Binaries (ARM) ARMv6, ARMv7,  ARMv8.

To install node.js on Ubuntu, start with the command line below.

# Adding the NodeSource APT repository for Debian-based distributions repository AND the PGP key for verifying packages

# Install Node.js from the Debian-based distributions repository

Note: Ensure you have the latest version of Ubuntu installed on your machine.

 

Checking the version of node running on your system.

Open your gitbash or command prompt

this will display the version of node you are running.

 

To check the version of npm your system is running

To upgrade your node version

Downloading the latest version of node and running it on your system you easily do the upgrade otherwise follow the instruction below.

Clean cache first

Then install upgrade

How upgrade on MAC 

  1. sudo npm cache clean f
  2. sudo npm install g n
  3. sudo n stable

You can also use Homebrew to uninstall packages that it installed:

How to uninstall node on your windows machine.