How to Install Node.js
To run JavaScript outside the browser (on your computer), you need to install Node.js. Node.js includes everything you need to execute JavaScript through the command line, including the Node runtime and npm (Node Package Manager).
This guide will walk you through installing Node.js on Windows, macOS, and Linux.
Installing Node.js on Windows
- Download the Installer
Go to the official Node.js website:
https://nodejs.org - Choose the LTS Version
Click on the LTS (Long Term Support) version. It is stable and recommended for most users. - Run the Installer
- Double-click the downloaded
.msi
file. - Follow the setup steps.
- Make sure “Add to PATH” is checked during installation.
- Double-click the downloaded
- Verify Installation
Open Command Prompt and run:
node -v
npm -v
These commands show the installed versions of Node.js and npm.
Check Out This Video on How to Install Node.js on Windows 11 (2025) – A Step-by-Step Guide for Beginners
Installing Node.js on macOS
- Download the Installer
Visit https://nodejs.org and download the macOS installer (.pkg file). - Install Node.js
- Run the
.pkg
file. - Follow the setup wizard to complete installation.
- Run the
- Verify Installation
Open Terminal and type: bashCopyEditnode -v npm -v
Installing Node.js on Linux (Debian/Ubuntu)
- Update Package Index bashCopyEdit
sudo apt update
- Install Node.js and npm bashCopyEdit
sudo apt install nodejs npm
- Check Installed Versions bashCopyEdit
node -v npm -v
For the latest versions, it’s recommended to use Node Version Manager (nvm) instead of the system package manager.
Alternative: Install with Node Version Manager (nvm)
nvm is a tool to manage multiple Node.js versions on one machine. Useful for development.
Steps to Install nvm (Linux/macOS):
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
After installation, reload your shell:
source ~/.bashrc # or ~/.zshrc depending on your terminal
Then install Node.js:
nvm install --lts
nvm use --lts
Verifying Node.js Installation
No matter which method you used, you can confirm everything is working by running:
node -v # Should print Node.js version
npm -v # Should print npm version
If you see version numbers, Node.js is successfully installed and ready for development.
Summary
Installing Node.js is the first step toward running JavaScript outside the browser. Whether you’re on Windows, macOS, or Linux, the process is straightforward. Once installed, you’ll also have access to npm
, which lets you install open-source JavaScript packages and tools.