How to Install Node.js on Windows, macOS, and Linux

Learn how to install Node.js on Windows, macOS, and Linux with step-by-step instructions. Set up Node.js and npm easily for JavaScript development.
How to Install Node.js on Windows, macOS, and Linux
Node.js is a popular JavaScript runtime that allows developers to build scalable web applications, backend services, and more. In this guide, we will walk you through the steps to install Node.js on Windows, macOS, and Linux.
1. Check if Node.js is Already Installed
Before installing, check if you already have Node.js by running the following command in your terminal or command prompt:
node -vIf Node.js is installed, this command will return the installed version number. If not, proceed with the installation.
2. Installing Node.js on Windows
Using the Official Installer
Visit the official Node.js website: https://nodejs.org
Download the LTS (Long-Term Support) version for stability.
Open the downloaded
.msiinstaller and follow the setup instructions.Ensure you check the box for adding Node.js to
PATHduring installation.Once installed, verify by running:
node -v
npm -v3. Installing Node.js on macOS
Using Homebrew (Recommended)
Homebrew is a package manager for macOS that makes installations easier.
Open Terminal and install Homebrew (if not installed):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Install Node.js:
brew install nodeVerify installation:
node -v
npm -v4. Installing Node.js on Linux
Using Node Version Manager (NVM) - Recommended
NVM allows you to install and manage multiple Node.js versions easily.
Install NVM:
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bashReload shell:
source ~/.bashrc # or source ~/.zshrc if using zshInstall the latest LTS version of Node.js:
nvm install --ltsVerify installation:
node -v
npm -vUsing Package Managers
For Ubuntu/Debian:
sudo apt update && sudo apt install nodejs npm -yFor Fedora:
sudo dnf install nodejs5. Verifying Node.js and npm Installation
Run the following commands to ensure Node.js and npm (Node Package Manager) are installed correctly:
node -v # Check Node.js version
npm -v # Check npm version6. Managing Node.js Versions
If you need to switch between multiple Node.js versions, use NVM:
nvm list # List installed versions
nvm use <version> # Switch to a specific versionConclusion
Congratulations! You have successfully installed Node.js on your system. You can now start building JavaScript applications and using npm to manage dependencies.
For more tutorials, visit CoderCrafter.








