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 versionnpm -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
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.