Search across all documentation pages
How to download and install Node.js and npm on macOS and Windows — including what LTS means, the different installation methods, and which one to pick.
Quick-reference recipe card — copy-paste ready.
# Check if Node.js is already installed
node --version
# Check npm version
npm --version
# Install Node.js via nvm (recommended for macOS/Linux)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
nvm install --lts
nvm use --lts
# Verify installation
node --version # e.g. v22.15.0
npm --version # e.g. 10.9.2When to reach for this: Before starting any React, Next.js, or Node.js project you need Node.js and npm installed. This is always step zero.
| Platform | Link | Notes |
|---|---|---|
| Official downloads | https://nodejs.org/en/download | Installers for all platforms |
| macOS / Linux (nvm) | https://github.com/nvm-sh/nvm | Version manager — recommended |
| Windows (nvm-windows) | https://github.com/coreybutler/nvm-windows | Windows-specific version manager |
| macOS (Homebrew) | brew install node | Single version via Homebrew |
| Windows (winget) | winget install OpenJS.NodeJS.LTS | Single version via winget |
| Windows (Chocolatey) | choco install nodejs-lts | Single version via Chocolatey |
| Volta | https://volta.sh | Cross-platform version manager |
| fnm | https://github.com/Schniz/fnm | Fast, Rust-based version manager |
Always download from nodejs.org or a trusted version manager. The download page offers two tracks: LTS and Current.
LTS stands for Long Term Support. Node.js follows a release schedule where even-numbered major versions (18, 20, 22, 24...) enter LTS status and receive bug fixes and security patches for 30 months. Odd-numbered versions (19, 21, 23...) are short-lived "Current" releases that only get support for 6 months.
| Track | Example | Support Window | Best For |
|---|---|---|---|
| LTS | Node 22.x | 30 months of patches | Production apps, teams, stability |
| Current | Node 23.x | ~6 months | Testing new features early |
Rule of thumb: Always use the latest LTS version unless you have a specific reason to run Current. Every production deployment, CI pipeline, and tutorial in this cookbook assumes LTS.
npm (Node Package Manager) is the default package manager that ships bundled with every Node.js installation. It does three things:
package.json and package-lock.json.package.json (e.g., npm run dev, npm test).When you install Node.js, you get npm for free. You do not need to install it separately.
# Install a package
npm install react
# Install dev dependencies
npm install --save-dev typescript
# Run a script from package.json
npm run dev
# Install all dependencies from package.json
npm installnvm (Node Version Manager) lets you install and switch between multiple Node.js versions. This is the best option for developers who work across projects that may require different Node versions.
# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
# Restart your terminal, then:
nvm install --lts # Install latest LTS
nvm use --lts # Activate it
nvm alias default lts/* # Make it the default for new shells
# Switch between versions
nvm install 20 # Install Node 20
nvm installs Node.js into ~/.nvm/ so it does not require sudo and avoids permission issues with global packages.
brew install node # Installs latest current version
brew install node@22 # Installs a specific LTS versionSimple, but only manages one version at a time. If you need to switch between versions, use nvm instead.
brew install fnm
fnm install --lts
fnm use --lts
# Add to shell profile (~/.zshrc or ~/.bashrc)
eval "$(fnm env --use-on-cd)"fnm is written in Rust and is noticeably faster than nvm for version switching. It also supports .node-version and .nvmrc files.
curl https://get.volta.sh | bash
volta install node@ltsVolta pins tool versions per-project in package.json so every contributor uses the same version automatically.
Download the .pkg file from https://nodejs.org/en/download and run it. Installs Node.js and npm system-wide into /usr/local/. Works, but harder to manage multiple versions and may require sudo for global installs.
nvm-windows is a separate project from nvm (not a port) but provides the same version-switching workflow.
.exe installernvm install lts # Install latest LTS
nvm use lts # Activate it
nvm list # List installed versionswinget install OpenJS.NodeJS.LTSBuilt into Windows 11 and available for Windows 10. Installs a single version system-wide.
choco install nodejs-ltsRequires Chocolatey to be installed first. Similar to Homebrew on macOS — manages one version at a time.
winget install Schniz.fnm
fnm install --lts
fnm use --ltsWorks on Windows, macOS, and Linux. Fast version switching.
# Download installer from https://volta.sh
volta install node@ltsDownload the .msi file from https://nodejs.org/en/download and run it. Installs Node.js, npm, and optionally adds to PATH. Simplest option but hardest to manage multiple versions.
| Situation | Recommended Method |
|---|---|
| Multiple projects, different Node versions | nvm (macOS/Linux) or nvm-windows |
| Want the fastest version switching | fnm |
| Team needs everyone on same version | Volta |
| Just need Node.js installed quickly | Homebrew / winget / official installer |
| CI/CD pipeline | Official installer or Docker node:22-alpine |
After installing, open a new terminal and run:
node --version
# v22.15.0 (or similar LTS version)
npm --version
# 10.9.2 (or similar)
# Quick smoke test — run a one-liner
node -e "console.log('Node.js is working!')"# With nvm
nvm install --lts --reinstall-packages-from=current
nvm use --lts
# With Homebrew
brew upgrade node
# With fnm
fnm install --lts
fnm use --lts
# With Volta
volta install node@ltsWhen upgrading Node.js, globally installed npm packages may need to be reinstalled. The --reinstall-packages-from=current flag in nvm handles this automatically.
npm install -g fails with EACCES, switch to nvm — it installs into your home directory and avoids permission issues entirely. Never use sudo npm install -g..nvmrc not auto-switching. nvm does not auto-switch Node versions when you cd into a directory with .nvmrc by default. Add autoload to your shell config or use fnm/Volta which do this out of the box.npm installs and manages packages. npx runs a package binary without installing it globally (e.g., npx create-next-app). Both ship with Node.js.node is not recognized after installation, check that the install directory was added to your system PATH. Restart your terminal or log out and back in.node --version shows a different version in VS Code, restart VS Code after installing or switching versions.Always install the latest LTS version unless a project specifies otherwise. LTS versions receive security patches and bug fixes for 30 months, making them the safe choice for production work and learning.
No. npm is bundled with Node.js. When you install Node.js, npm is included automatically. You can verify with npm --version.
npm installs and manages packages. npx executes a package binary — either from your local node_modules/.bin or by temporarily downloading it. For example, npx create-next-app runs the create-next-app generator without installing it globally.
Both work well. nvm is the most widely used and documented. fnm is faster (written in Rust) and supports auto-switching on cd out of the box. If speed matters to you, use fnm. If you want the broadest community support, use nvm.
Yes, if you use a version manager (nvm, fnm, Volta, nvm-windows). They install each version in its own directory and let you switch between them with a single command. The official installer only manages one version.
.nvmrc file?A .nvmrc file in a project root contains the Node.js version that project expects (e.g., 22). When you run nvm use in that directory, nvm reads the file and switches to that version. fnm and Volta support similar files and can auto-switch when you cd into the directory.
With nvm: nvm uninstall 20. With Homebrew: brew uninstall node. With the official installer on macOS, you need to manually remove files from /usr/local/. On Windows, use Add/Remove Programs.
npm install -g fail with permission errors?The official Node.js installer places files in system directories that require root access. The fix is to switch to nvm or fnm, which install into your home directory. Never use sudo npm install -g — it creates files owned by root that cause further permission issues.
Bun and Deno are alternative JavaScript runtimes. They can run many Node.js scripts but have different APIs and ecosystems. For React and Next.js development, Node.js remains the standard runtime. You can explore Bun or Deno for specific use cases, but start with Node.js.
Check the engines field in package.json (e.g., "engines": { "node": ">=20" }), look for a .nvmrc or .node-version file, or check the project README. If none exist, use the latest LTS version.