Installing Node and npm

Set up the toolchain every real React project needs: Node.js to run JavaScript outside the browser, and npm to install packages.

Step 1 of 3

Why you need Node and npm

Until now, your JavaScript only ran inside a browser. But a Next.js project needs to run JavaScript on your computer too — to start a development server, bundle your code, and render pages on the server. The program that runs JavaScript outside the browser is Node.js.

Bundled with Node is npm (Node Package Manager). It does two jobs:

  • Installs packages — downloads code other developers share, like React and Next.js itself, into your project.
  • Runs scripts — commands like npm run dev (start the dev server) and npm run build (build for production).

Install the LTS ("Long-Term Support") version — Next.js 16 needs Node 20.9 or newer. Get it from nodejs.org, or use a version manager like nvm if you'll juggle multiple projects.

Think of it this way: If the browser is a kitchen that cooks your food for diners (users), Node is your home kitchen where you prep, test, and package everything first. npm is the grocery delivery service that brings you ingredients (packages) other chefs already made.
Web Standard

Node.js runs the same JavaScript language you already know, just outside the browser. The difference: there's no window or document on the server — those only exist in the browser. Server code works with files, networks, and data instead.