To install Node.js, download the LTS installer from nodejs.org, run it, and complete the setup wizard. Node.js comes bundled with npm (Node Package Manager), so you get both in one install. Verify by running node -v and npm -v in your terminal.

This guide covers three ways to install Node.js on each operating system, how to switch versions with nvm, and how to fix the most common errors.

Quick answer: For most people, the easiest method is downloading the LTS installer from nodejs.org and running it. For developers who work on multiple projects, use nvm instead โ€” it lets you switch Node versions per project.

What Is Node.js (and Why Install It)?

Node.js is a JavaScript runtime that lets you run JavaScript outside the browser. It powers:

If you're learning JavaScript, React, Next.js, or any modern web framework, you need Node.js installed. It's the foundation of the entire JavaScript ecosystem.

Which Version Should You Install โ€” LTS or Current?

Node.js releases in two tracks:

When in doubt, choose LTS. Every framework and library on npm targets LTS first.

Installation Guide (Choose Your OS)

Option 1: Official Installer (Easiest)

Step 1
Download the installer

Go to nodejs.org. Click the LTS button. Your browser downloads an .msi file for Windows.

Step 2
Run the installer

Double-click the downloaded .msi file. Click Next through the wizard. Accept the license, keep the default install location, and leave the "Tools for Native Modules" checkbox unchecked unless you need to compile native addons.

Step 3
Verify installation

Open Command Prompt or PowerShell (Win + R โ†’ type cmd) and run these two commands:

$ node -v
v22.11.0
$ npm -v
10.9.0

If you see version numbers, you're done.

Option 2: Windows Package Manager (winget)

If you prefer the command line, open PowerShell and run:

PS> winget install OpenJS.NodeJS.LTS

This installs Node.js LTS silently. Run node -v to confirm.

Option 3: nvm-windows (Best for Multiple Versions)

If you need to switch between Node versions, install nvm-windows:

Step 1
Download nvm-windows

Get the latest nvm-setup.exe from github.com/coreybutler/nvm-windows/releases.

;
Step 2
Install and use
PS> nvm install lts
PS> nvm use lts

Option 1: Official Installer (Easiest)

Step 1
Download the .pkg installer

Go to nodejs.org, click LTS, and download the macOS .pkg file.

Step 2
Run the installer

Double-click the .pkg file. Follow the wizard. Enter your Mac password when prompted.

Step 3
Verify installation
$ node -v
v22.11.0
$ npm -v
10.9.0

Option 2: Homebrew (Recommended)

If you have Homebrew installed, this is the fastest method:

$ brew install node

Homebrew installs the latest LTS version and keeps it updated with brew upgrade.

Option 3: nvm (Best for Multiple Versions)

nvm on macOS lets you switch Node versions per project โ€” essential if you work on multiple codebases.

Step 1
Install nvm
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
Step 2
Reload your shell
$ source ~/.zshrc # or ~/.bashrc
Step 3
Install Node.js LTS
$ nvm install --lts
$ nvm use --lts

Option 1: nvm (Recommended)

On Linux, nvm is the best way โ€” it avoids permission issues and lets you switch versions freely.

Step 1
Install nvm
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
Step 2
Reload your shell
$ source ~/.bashrc
Step 3
Install Node.js
$ nvm install --lts
$ nvm use --lts
$ node -v

Option 2: NodeSource (Ubuntu / Debian)

Add the NodeSource repository to get the latest LTS:

$ curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
$ sudo apt install -y nodejs

Option 3: Distribution Package Manager

Every distro has Node in its default repos, but it may be an older version:

# Ubuntu / Debian
$ sudo apt install nodejs npm

# Fedora / RHEL
$ sudo dnf install nodejs npm

# Arch Linux
$ sudo pacman -S nodejs npm

Note: Distro packages often ship older versions. If you need the latest LTS, use nvm or NodeSource instead.

Verify the Installation

Regardless of which method you used, run these two commands:

$ node -v
$ npm -v

Both should print version numbers like v22.11.0 and 10.9.0. If they do, you're set.

Understanding npm (Comes with Node)

npm is the package manager that ships with Node.js. You don't need to install it separately. Common commands:

# Initialize a new project (creates package.json)
$ npm init -y

# Install a package locally
$ npm install express

# Install a global CLI tool
$ npm install -g typescript

# Run a package without installing
$ npx create-react-app my-app

Test Your Installation

Create a file called hello.js and run it:

// hello.js
console.log("Node.js is working! ๐ŸŽ‰");
console.log("Node version:", process.version);

Then run:

$ node hello.js
Node.js is working! ๐ŸŽ‰
Node version: v22.11.0

Common Installation Errors (and Fixes)

"node: command not found" (macOS/Linux)

Your shell doesn't know where Node is. If you used nvm, run source ~/.bashrc (or ~/.zshrc) to reload the config. If you used a package manager, restart your terminal.

"'node' is not recognized as an internal or external command" (Windows)

This means Node's install folder isn't on the system PATH. Close the terminal and reopen it. If that doesn't work, restart your PC. If the issue persists, reinstall Node.js and make sure "Add to PATH" is checked.

EACCES permission errors with npm

This happens when you run npm install -g without proper permissions. Fix it by installing nvm, or by configuring npm to use a user directory:

$ mkdir ~/.npm-global
$ npm config set prefix '~/.npm-global'
$ export PATH=~/.npm-global/bin:$PATH

Old Node version installed

If node -v shows an older version than expected, you likely have multiple installs. Check with which node (macOS/Linux) or where node (Windows). Remove the old one or use nvm to control versions.

Uninstalling Node.js

Next Steps After Installing Node.js

Once Node.js is installed, the natural next steps are:

๐Ÿงฉ Developer Tools

Working with Node? Try our free JSON Formatter, Regex Tester, and Base64 Encoder.

Browse All Tools โ†’

Frequently Asked Questions

How do I install Node.js?

;

Download the LTS installer from nodejs.org and run it. On macOS or Linux you can also use a package manager like Homebrew or nvm. After installation, verify by running node -v and npm -v in your terminal.

Which Node.js version should I install โ€” LTS or Current?

Install LTS for production or everyday use. It's stable, widely tested, and supported for years. Choose Current only if you need the newest features and can handle occasional breakage.

What is the difference between Node.js and npm?

Node.js is the JavaScript runtime. npm is the package manager bundled with it. When you install Node, npm comes automatically โ€” you don't install it separately.

Do I need to install npm separately?

No. npm is bundled with every Node.js installer. If node -v works, npm -v will too.

What's the difference between npm and npx?

npm installs packages. npx runs packages without installing them permanently. For example, npx create-react-app my-app downloads and runs the React scaffolding tool without polluting your global install.

How do I switch Node.js versions?

Use nvm (Node Version Manager). Install it once, then run nvm install 20 to install Node 20, nvm install 22 for Node 22, and nvm use 20 to switch. Each project can have its own version via an .nvmrc file.

Is Node.js free?

Yes. Node.js is open source and free for personal and commercial use.

Does Node.js work on Windows?

Yes. Node.js has native Windows support and runs on Windows 10, 11, and Windows Server. Both the official installer and nvm-windows work well.