[React][Setup] Install Node.js with NVM
Install and switch Node.js versions per project with NVM on Windows and macOS - avoid version conflicts when working on React, Vite, and Next.js apps.

1. Environment
- OS: Windows 11 / macOS
- Toolchain: NVM (Node Version Manager), Node.js, npm
- Terminal: PowerShell (Windows) / zsh (macOS)
2. Problem
To build React, Vite, Next.js, and similar apps, Node.js must be installed on your machine.
You can open the official site and click the green download button - but that is usually not how teams do it in practice.
When you work on several projects at once, each one may require a different Node.js version, and those versions collide.
3. Cause
A typical real-world situation looks like this:
- Legacy project A only runs on Node 16, while new project B needs Node 20 or newer.
- If you install Node 20 from the website as a single system install, it overwrites Node 16 and breaks project A.
- Uninstalling and reinstalling Node every time you switch projects is slow and error-prone.
4. Solution
1) Install NVM for your OS
Windows
- Open the NVM for Windows releases page: nvm-windows releases
- Download
nvm-setup.exeand finish the installer by clicking Next with the default options.
macOS
- Open Terminal and install NVM with curl:
# Install NVM on macOS with curl
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
- Important: After install finishes, fully quit Terminal and open it again so the
nvmcommand is recognized.
2) Verify NVM
Open a terminal and confirm NVM is available (Windows and macOS):
nvm --version
3) Check and install the latest Node.js LTS
Node.js ships a Current line (new features) and an LTS line (Long Term Support, the practical default). Prefer LTS for real work.
Windows
# List installable Node.js versions
nvm list available
# Install the latest LTS automatically
nvm install lts
# Or install a specific version (example: 22.11.0)
nvm install 22.11.0
macOS
# List remote Node.js versions
nvm ls-remote
# Install the latest stable LTS
nvm install --lts
# Or install a specific version
nvm install 22.11.0
4) Activate the installed version and verify
Installing is not enough - you must tell NVM which version to use.
Windows and macOS:
# List Node.js versions installed on this machine
nvm list
# Activate a specific version (required)
nvm use 22.11.0
Finally, confirm Node.js and the bundled npm (Node Package Manager):
node -v
npm -v
5. Summary
- NVM (Node Version Manager): Install and switch Node.js versions per project without conflicts.
- Node.js: The runtime that runs JavaScript for React, Next.js, and other frontend tooling outside the browser.
- npm (Node Package Manager): Comes with Node.js and lets you install libraries from the ecosystem into your projects.


