Installing Node.js
Before you can run a single line of server-side JavaScript you need Node.js on your machine. Installing Node also installs npm (the package manager) and npx (the package runner) automatically — they ship in the same bundle. This page surveys your options and the trade-offs; the OS-specific pages then go step by step.
What actually gets installed
A Node install is not one program but a small toolkit. Knowing what each piece is prevents confusion later:
Binary | What it is |
|---|---|
| The runtime itself — runs your JavaScript files |
| The package manager — installs dependencies, runs scripts |
| Runs a package bin without a global install ( |
| Shim that manages |
Which version should I install?
Pick the latest LTS (Long-Term Support) release — the even-numbered lines (18, 20, 22…). LTS versions are stable and supported for ~30 months, which is what you want for real projects. Use Current only to experiment with the newest features on a throwaway branch. Full breakdown in LTS vs Current Releases.
Three ways to install
Method | Best for | Trade-off |
|---|---|---|
Official installer | Beginners, a single fixed version | Switching versions later is manual |
Version manager ( | Anyone with more than one project | One extra setup step — worth it |
OS package manager ( | Matching your system tooling | Distro versions often lag behind |
Verify your installation
After installing, open a fresh terminal (so it picks up the new PATH) and check the versions:
node --version # or: node -v npm --version # or: npm -v
v20.11.0 10.2.4
Troubleshooting "command not found"
Symptom | Likely cause & fix |
|---|---|
| Terminal has stale PATH — close and reopen it (or restart) |
Old version after upgrade | A second Node is earlier on PATH — check |
Works in one terminal, not another | Shell profile ( |
| Node is in a root-owned dir — switch to a version manager |
which node # macOS/Linux: where is the node binary? where node # Windows: same question
Run your first command
The -e flag ("evaluate") runs a string of code directly — a quick way to confirm the runtime works without creating a file:
node -e "console.log('Node is working!')"Node is working!