Installing Node.js
Overview
Before writing any Node code, you need Node itself. That sounds simple, but there are two decisions worth getting right from the start: which version to install, and how to install it so you can switch versions later. A few minutes here saves hours of “it works on my machine” problems.
Which version?
Node.js releases a new major version regularly. Each one moves through a lifecycle:
- Current — the newest features, still settling. Good for trying things out; not for production.
- Active LTS (Long-Term Support) — stable, receiving bug and security fixes. This is what you should use.
- Maintenance — security fixes only. Fine for existing apps, but plan an upgrade.
- End of life — no more fixes. Don’t run it anywhere that matters.
At the time of writing (December 2026), Node.js 26 is the Active LTS release. Node 24 is in maintenance. Until Node 26, only even-numbered versions became LTS; starting with Node 27, Node.js publishes one major release a year in April and promotes it to LTS each October. Check the current status at nodejs.org whenever you start a new project.
Rule of thumb: use the latest Active LTS. Everything in this course works on Node 22 and newer.
Install with a version manager
You can download an installer from nodejs.org, but a version manager is better. Different projects often need different Node versions, and a version manager lets you install several side by side and switch with one command — no administrator rights needed.
macOS and Linux: nvm
# Install nvm (check github.com/nvm-sh/nvm for the latest command)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
# Restart your terminal, then:
nvm install --lts # install the latest LTS
nvm use --lts
nvm alias default lts/* # use it in every new terminalWindows: fnm or nvm-windows
On Windows, fnm (Fast Node Manager) works well in PowerShell and Windows Terminal:
winget install Schniz.fnm
fnm install --lts
fnm use lts-latestnvm-windows is a popular alternative with similar commands (nvm install lts, nvm use …). Volta is another cross-platform option that pins versions per project automatically.
Check it worked
node --version # e.g. v26.4.0
npm --version # e.g. 11.6.0
npx --versionInstalling Node also gives you npm (the package manager) and npx (which runs package commands without installing them globally). You’ll use both throughout the course.
Pin the version per project
Tell everyone — and every server — which Node version a project expects. Create an .nvmrc file in the project folder:
26Now anyone running nvm use (or fnm use) in that folder gets the right version automatically. Also add an engines field to package.json, which npm can warn about:
{
"engines": { "node": ">=26" }
}Hosting platforms and Docker images read these too, so your app runs on the same version everywhere.
Terminal basics
You’ll run Node from a terminal. These commands cover almost everything you need:
| Task | macOS / Linux | Windows PowerShell |
|---|---|---|
| Where am I? | pwd |
pwd |
| List files | ls |
ls or dir |
| Change folder | cd projects |
cd projects |
| Go up a folder | cd .. |
cd .. |
| Make a folder | mkdir my-app |
mkdir my-app |
| Clear the screen | clear |
cls |
| Stop a running program | Ctrl + C |
Ctrl + C |
Press Tab to auto-complete file and folder names, and the up arrow to repeat earlier commands.
Set up your editor
Use the same editor setup as in JavaScript Essentials: VS Code with Prettier and ESLint. Two extras help with Node work:
- VS Code’s integrated terminal (
Ctrl + `) lets you run Node without leaving the editor. - The built-in JavaScript Debug Terminal lets you set breakpoints in Node code just like in the browser. You’ll use it in the debugging lessons.
Avoid
sudo npm install -g. If installing global packages asks for administrator rights, your Node installation is set up the hard way. A version manager installs everything in your home folder, so you never needsudo.
Check your setup
Install Node with a version manager, then run the commands below in your terminal. Write down the versions you see. Bonus — install a second Node version and switch between them.
node --version
npm --version
node -e "console.log(process.platform, process.arch)"# Example output (yours may differ):
# v26.x.x
# 11.x.x
# darwin arm64
# Switching versions with nvm:
nvm install 24
nvm use 24
node --version # v24.x.x
nvm use 26Summary
- Use an Active LTS release (even-numbered lines up to Node 26; every release from Node 27) for real projects.
- A version manager (nvm, fnm or Volta) lets you install and switch Node versions per project.
- Installing Node also installs npm and npx.
- Pin the version for a project with an
.nvmrcfile and theenginesfield. - Learn a handful of terminal commands —
cd,ls/dir,mkdir— and you’re ready.