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:
- Web servers and APIs (Express, Fastify, NestJS)
- Frontend build tools (Vite, Webpack, Next.js, React scripts)
- Command-line utilities (npm, npx, TypeScript compiler)
- Desktop apps (Electron, Tauri)
- Scripting and automation
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:
- LTS (Long Term Support): Stable, well-tested, supported for 30 months. Use this for production.
- Current: Latest features, updated every 6 months. Use this only if you need a specific new feature.
When in doubt, choose LTS. Every framework and library on npm targets LTS first.
Installation Guide (Choose Your OS)
Option 1: Official Installer (Easiest)
Go to nodejs.org. Click the LTS button. Your browser downloads an .msi file for Windows.
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.
Open Command Prompt or PowerShell (Win + R โ type cmd) and run these two commands:
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:
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:
Get the latest nvm-setup.exe from github.com/coreybutler/nvm-windows/releases.
PS> nvm use lts
Option 1: Official Installer (Easiest)
Double-click the .pkg file. Follow the wizard. Enter your Mac password when prompted.
v22.11.0
$ npm -v
10.9.0
Option 2: Homebrew (Recommended)
If you have Homebrew installed, this is the fastest method:
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.
$ nvm use --lts
Option 1: nvm (Recommended)
On Linux, nvm is the best way โ it avoids permission issues and lets you switch versions freely.
$ nvm use --lts
$ node -v
Option 2: NodeSource (Ubuntu / Debian)
Add the NodeSource repository to get the latest LTS:
$ 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:
$ 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:
$ 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:
$ 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:
console.log("Node.js is working! ๐");
console.log("Node version:", process.version);
Then run:
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:
$ 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
- Windows: Settings โ Apps โ find Node.js โ Uninstall
- macOS:
brew uninstall nodeor remove via the installer's uninstall script in/usr/local/ - Linux:
sudo apt remove nodejs npmornvm uninstall <version>
Next Steps After Installing Node.js
Once Node.js is installed, the natural next steps are:
- Install a code editor โ see our VS Code install guide
- Learn JavaScript basics
- Try a first project โ build a simple CLI or Express server
- Explore our free JavaScript course
๐งฉ 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.