Installing Node.js and npm
What you get
Node.js runs JavaScript outside the browser. npm ships with Node and installs packages from the registry.
Install options
- Download an LTS installer from the official Node.js site
- Use a version manager such as nvm or fnm if you switch versions often
- On many Linux distros, prefer NodeSource, nvm, or the distro's current package—avoid very old system Node
Check versions
Open a new terminal after install so PATH updates apply.
node --version
npm --version
First REPL peek
Run node with no file to open a prompt. Type an expression, then .exit to leave.
node
> 2 + 2
4
> .exit
Comments
One comment per signed-in account. Comments are saved with this page’s URL.