Skip to content
Cover image for "Learning NodeJS: How to Install NodeJS on Windows, MacOS, and Linux Ubuntu" - Blog post by Muhammad Rivki about Backend

Learning NodeJS: How to Install NodeJS on Windows, MacOS, and Linux Ubuntu

Written on 3 min read
Available in:
🇺🇸EN🇮🇩ID

If you want to build a modern web application, you'll likely need NodeJS. In this article, I'll explain how to install NodeJS on Windows, MacOS, and Linux Ubuntu.

Install NodeJS

For Windows and MacOS users, the installation is straightforward, like installing any other application: click, next, next...

NodeJS Homepage
Nodejs Homepage

You simply need to go to the NodeJS homepage and download it by clicking the large green button that says "LTS (Recommended for Most Users)". LTS stands for Long Time Support. The LTS version is more stable than the version labeled Current and gets the newest features and improvements with longer support compared to non-LTS versions.

NodeJS Release
Release and maintenance schedule

Installation on Windows

Installing on Windows is straightforward, like installing any other application. The main thing you need is the NodeJS executable file that you can download from the homepage. Here are the steps required to install NodeJS on Windows:

  1. Download NodeJS LTS from the homepage
  2. Once downloaded, double-click the executable file
  3. Once installed, you can verify it via command prompt (cmd)
  4. After opening cmd, you can type the following command to check which version is installed on your device:
node --version
# -> v12.9.1

If you want to install NodeJS on WSL, you can follow the Ubuntu installation steps

Installation on MacOS

There are 2 ways to install on MacOS: the first is similar to Windows, and the second is using Homebrew. I recommend using Homebrew as it's easier. Here are the steps if you install using Homebrew:

  1. Install Homebrew if you don't have it yet. Type this script in your terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  1. Once installed, you can verify it by typing this script:
brew -v
# -> Homebrew 2.2.2
  1. After that, you can type the following command in your terminal:
brew install node
  1. If the installation is successful, you can verify it in the terminal like this:
node -v
# -> v12.9.1
npm -v
# -> 6.10.2

And you're ready to work with NodeJS on your Mac.

Installation on Ubuntu

For Ubuntu users or WSL Ubuntu on Windows, here are the steps:

  1. First, you need curl. If you don't have curl, you can type this command in your terminal:
sudo apt-get install curl
  1. Then add the NodeJS source with the following command:
# setup_12.x where 12 is the NodeJS version. If you want version 14
# You can change it to setup_14.x
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
  1. After adding the NodeJS source, type the following command to install NodeJS:
sudo apt-get update
sudo apt-get install nodejs
  1. After installation, you can verify it in the terminal using the following command:
node -v
# -> v12.9.1
npm -v
# -> 6.10.2

Summary

In this article, I've explained how to install NodeJS on Windows, Mac, and Ubuntu. If you want to install NodeJS, it's recommended to choose the LTS version. The LTS version is more stable than other versions and you get the newest features and improvements from NodeJS.

Blog