Peter Girnus

View Original

How to Install Node.JS on Windows, MacOS, and Linux

Node.js is a cross-platform, open-source runtime environment enabling developers to run JavaScript code outside a web browser. NodeJS is built on top of the Google V8 JavaScript engine, the same JavaScript engine used in Google Chrome. Node.js provides developers with a range of features and modules that allow them to build and execute server-side applications using JavaScript. Additionally, Node.js can be installed on various operating systems using package managers such as Windows winget, macOS Homebrew, and Debian apt. This tutorial will walk you through some of the most popular methods to install Node.JS, depending on your operating system of choice. Node.js offers JavaScript a rich ecosystem to build feature-rich applications through tools such as the Node Package Manager (npm).

Check if NodeJS is Already Installed

To ensure the smooth execution of the upcoming tasks, we must confirm whether NodeJS has already been installed on our system. This will help us avoid any unforeseen errors and ensure that everything runs smoothly.

Verify NodeJS Version

To determine the exact Node version currently installed on your system, you can use a command that helps you fetch this information. The command that you need to execute to obtain the installed Node version is `node --version`. Once you run this command, the output will display the version number of NodeJS currently installed on your system.

Upgrade NodeJS Version

If you want to upgrade your current NodeJS runtime environment, use the Node Package Manager (NPM) `npm install n -g` command to upgrade your NodeJS environment.

Install Node.JS on Windows 11

To set up our project, we need to install Node.JS, an open-source, cross-platform JavaScript runtime environment that allows us to execute JavaScript code outside of a web browser. 

The Node.JS runtime environment can be easily installed on Windows 11 by using the Windows Package Manager (winget), which is a command-line tool that helps you discover and install software packages quickly. 

To install Node.JS on Microsoft Windows 11, run the following command in the command prompt or PowerShell:

winget install Node.JS

This command will download and install the latest version of Node.JS on your computer. Once installed, you can start using Node.JS to run JavaScript code and build applications.

Install Node.JS on MacOS

If you have an Apple computer running on the macOS operating system, you can easily download and install Node.JS through the Homebrew package manager. Using Homebrew, you can easily manage Node.JS and its dependencies on your system. In order to install node with Homebrew simply execute the following command from the command-line interface.

brew install node

Using this command, Homebrew will download and install the latest version of Node.JS, making it readily available for use in your projects.

Install Node.JS on Ubuntu & Debian Linux

Installing Node.JS on Ubuntu and Debian Linux machines is as simple as using the apt package manager to download and install the NodeJS and the Node Package Manager (NPM).

sudo apt install Node.JS 

Install Node.JS on Arch Linux

Installing Node.JS on Arch Linux machines can be accomplished using the Pacman package manager to download and install the NodeJS and the Node Package Manager (NPM).

pacman -S nodejs npm

Install Node.JS on CentOS, Fedora, and Red Hat Enterprise Linux

To install Node.JS on RedHat Linux-based machines, we can use the DNF package manager to download and install the NodeJS and the Node Package Manager (NPM).

dnf module install nodejs:21/common

Installing Node.JS Using Other Package Managers

For a full list of how to install Node.JS using other major package managers, see the Installing Node.js via package manager documentation. I hope you found this brief tutorial insightful and informative, happy building with NodeJS.

See this social icon list in the original post