Skip to content
Node.js introduction 2 min read

Installing Node.js

There are several ways to install Node.js. For real development work we strongly recommend a version manager so you can switch between Node versions per project. We’ll also cover the official installer and how to verify everything works.

nvm (Node Version Manager) lets you install multiple Node versions side by side and switch instantly. This matters because different projects pin different Node versions.

Install nvm on macOS or Linux:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash

Reload your shell, then install and use the latest LTS:

nvm install --lts
nvm use --lts
nvm alias default lts/*

To switch versions later:

nvm install 22        # install a specific major
nvm use 22            # activate it for this shell
nvm ls                # list installed versions

On Windows, use nvm-windows or fnm, a fast cross-platform alternative.

Alternative: the official installer

If you prefer a one-time setup, download a prebuilt package from nodejs.org. The installer adds node and npm to your PATH globally. This is simple, but you can only have one version installed at a time—fine for beginners, limiting for teams.

On macOS you can also use Homebrew:

brew install node

LTS vs Current

Node publishes two release lines. Choose based on your needs:

LineAudienceStability
LTS (Long-Term Support)Production appsEven-numbered majors, supported ~30 months
CurrentEarly adoptersLatest features, shorter support window

For anything you’ll deploy, use LTS. Reach for Current only to try cutting-edge language or runtime features.

Verifying the install

Confirm both binaries are available and check their versions:

node -v
npm -v

Output:

v22.11.0
10.9.0

node runs scripts and the REPL; npm is the package manager that ships with Node. If either command is “not found,” restart your terminal so PATH changes take effect.

The REPL

Running node with no file opens an interactive Read-Eval-Print Loop—a sandbox for experimenting:

node
Welcome to Node.js v22.11.0.
> 2 + 2
4
> [1, 2, 3].map((n) => n * 2)
[ 2, 4, 6 ]
> .exit

Useful REPL commands: .help lists shortcuts, .load file.js runs a file, .editor opens multi-line edit mode, and _ holds the last result. Press Ctrl+C twice or type .exit to leave.

Running scripts

Create a file and run it directly:

echo "console.log('It works')" > hello.js
node hello.js

Output:

It works

With Node installed and verified, you’re ready to start working with modules and npm in the next section.

Last updated June 1, 2026
Was this helpful?