agyanadda@gmail.com

Node.js Installation

Node.js Basics 1 min read Updated Dec 3, 2026 Topic 2 of 30

Download

Go to nodejs.org and download the LTS (Long Term Support) version. LTS is stable and recommended for most users. The installer also installs npm, Node's package manager.

Check the installation

Open a new terminal and run:

  • node -v — shows the Node version
  • npm -v — shows the npm version

The REPL

Type node alone to open the REPL (Read–Eval–Print Loop) — type JavaScript and see the result immediately. Press Ctrl+C twice to exit.

Managing versions with nvm

Different projects may need different Node versions. A version manager makes switching easy:

  • macOS / Linux: nvm — nvm install --lts, nvm use 22
  • Windows: nvm-windows or fnm

Editor

VS Code is the most popular editor for Node.js, with a built-in terminal and debugger.

Example

Example — Check your setup Bash
node -v
# v22.11.0   (your version may differ)

npm -v
# 10.9.0

# Try the REPL
node
> 2 + 3
5
> 'agyan'.toUpperCase()
'AGYAN'
> .exit

If node -v prints a version number, Node.js is installed correctly. .exit (or Ctrl+C twice) leaves the REPL.

Test Yourself With Exercises

Exercise 1 Multiple Choice

Which Node.js version is recommended for most users?

Exercise 2 True / False

npm is installed together with Node.js.

Exercise 3 Fill in the Blank

Check the Node version with node ___

Frequently Asked Questions

Close and reopen the terminal (or restart the computer) so the PATH updates. If it still fails, reinstall Node.js and make sure "Add to PATH" is selected.