TechEarl

How to Check Your Node.js and npm Version

Run node --version and npm --version to see what you have installed. This covers every way to check Node and npm, finding which install is on PATH, reading the version inside a script, and the gotchas with version managers and multiple installs.

Ishan Karunaratne⏱️ 9 min readUpdated
Share thisCopied
Terminal output of node --version and npm --version showing the installed Node.js and npm release numbers on the command line

To check your Node.js version, open a terminal and run node --version. To check npm, run npm --version. Both print a single line: node --version shows something like v22.11.0, and npm --version shows the bundled npm, something like 10.9.0. That is the whole answer for most people. The interesting part is everything around it: which Node install actually answered (you may have several), how to read the version from inside a script, and why node -v and your version manager sometimes disagree. I have spent more time than I would like debugging a CI job that ran a different Node than the one I checked by hand, so the "which install is on PATH" section below is the one I would not skip.

Current Node.js
26.2.0

Latest release with newest features. Best for experimentation.

Latest LTS
24.16.0

Long-Term Support — the version to use in production.

How do I check my Node.js version?

Run node --version (or the short form node -v) in any terminal. It prints the active version with a leading v:

bash
node --version
# v22.11.0

node -v
# v22.11.0

For npm, run npm --version or npm -v:

bash
npm --version
# 10.9.0

If either command prints command not found (Linux/macOS) or is not recognized (Windows), Node is not installed or not on your PATH. See installing Node for that case. If the version is older than you expected, see updating Node.

Jump to:

node --version vs node -v

They are identical. node --version and node -v both print the version string and exit; -v is just the short alias. Either works in every Node release since the beginning. I use node -v interactively and node --version in scripts and docs because the long form reads clearly to someone who has never seen it.

The output is the semantic version of the running binary, prefixed with v:

bash
node -v
# v22.11.0
#  ^  ^  ^
#  |  |  patch
#  |  minor
#  major (even = LTS line, odd = Current line)

The major number tells you the release line. Even majors (20, 22, 24) are LTS; odd majors (21, 23, 25) are short-lived Current releases. The live card at the top of this page shows what is current right now.

Check the npm version

npm ships bundled with Node, so it is installed already. Check it the same way:

bash
npm --version
# 10.9.0

npm -v
# 10.9.0

Note there is no leading v on npm's output, unlike Node. That bites people writing string comparisons in scripts.

For a fuller picture, npm version (no dashes) prints npm's own version plus the Node version, V8, and the platform libraries, as a small object:

bash
npm version
# {
#   npm: '10.9.0',
#   node: '22.11.0',
#   v8: '12.4.254.21-node.21',
#   ...
# }

That single command is the fastest way to see Node and npm together without running two commands. One thing to know: if you run npm version inside a directory that has a package.json, npm prepends that project's own version as the first key (for example myproject: '1.0.0'), then lists npm, node, and the rest. Outside a project the object starts at npm. Either way, the node and npm keys are what you are after.

If you want the full runtime breakdown straight from Node without npm in the picture, node -p evaluates an expression and prints the result, so you can dump every bundled library version in one line:

bash
node -p "process.versions"
# {
#   node: '22.11.0',
#   v8: '12.4.254.21-node.21',
#   uv: '1.49.2',
#   ...
# }

That is the same object you would log from inside a script (see reading the version inside a script), without writing a file or dropping into the REPL.

Which Node is actually running (PATH)

This is the part that causes real confusion. node -v reports whatever node binary your shell finds first on PATH. If you have a system install, a version-manager install, and maybe a Homebrew install all present, they fight, and the one that wins is not always the one you think.

Find the actual binary:

bash
# Linux / macOS
which node
# /Users/you/.nvm/versions/node/v22.11.0/bin/node

# Windows (PowerShell)
where.exe node
# C:\Program Files\nodejs\node.exe

The path tells you the install type at a glance:

Path containsInstall type
.nvm/versions/node/nvm
.fnm/ or fnm_multishellsfnm
.volta/Volta
/usr/local/bin/node or /usr/bin/nodesystem / package manager
Cellar/node (macOS)Homebrew
Program Files\nodejs (Windows)the official .msi installer

On Linux and macOS, command -v node does the same job and is the more portable form in scripts. If you suspect more than one install, list them all:

bash
# Linux / macOS, show every node on PATH
type -a node
# node is /Users/you/.nvm/versions/node/v22.11.0/bin/node
# node is /usr/local/bin/node

The first line wins. When node -v and a version manager disagree (for example nvm current says one thing, node -v another), it is almost always because the version manager's shell hook has not loaded in that shell, so PATH still points at the system binary. Open a fresh terminal, or re-source your shell rc file.

Read the version inside a script

Inside a running Node process, the version is on process.version (a string, with the v) and process.versions (an object with Node, V8, and every bundled library):

javascript
console.log(process.version);
// v22.11.0

console.log(process.versions.node);
// 22.11.0  (no leading v)

console.log(process.versions);
// { node: '22.11.0', v8: '12.4.254.21-node.21', uv: '1.49.2', ... }

process.versions.node is the clean numeric string, easier to parse than process.version because it has no v to strip. To gate behaviour on a major version:

javascript
const major = parseInt(process.versions.node.split(".")[0], 10);
if (major < 20) {
  console.error("This tool needs Node 20 or newer.");
  process.exit(1);
}

From a shell script, capture the CLI output instead:

bash
NODE_MAJOR=$(node -v | sed 's/v//' | cut -d. -f1)
echo "Running Node major: $NODE_MAJOR"

The sed 's/v//' strips the leading v that node -v prints; process.versions.node would not need it, which is why the in-process value is nicer when you have the choice.

Check the version a project expects

Knowing your installed version is half the question. The other half is what a given project wants. Look at package.json:

bash
# the engines field declares the supported range (advisory)
cat package.json | grep -A2 '"engines"'
#   "engines": {
#     "node": ">=20.0.0"
#   }

A project may also pin an exact version in a .nvmrc or .node-version file:

bash
cat .nvmrc
# 22

If your installed node -v falls outside the project's engines.node range, npm install warns by default (and errors if the project sets engine-strict=true in .npmrc). Matching the two is what pinning a Node version per project is for.

Version managers: nvm, fnm, Volta

If you use a version manager, it has its own command to show what it considers active, which is worth cross-checking against node -v:

ManagerShow active versionList installed versions
nvmnvm currentnvm ls
fnmfnm currentfnm list
Voltavolta list nodevolta list all
nn --version shows n itself; node -v for activen ls
asdfasdf current nodejsasdf list nodejs

If node -v and nvm current disagree, the manager's shell integration has not loaded in the current shell (the most common cause), or another node earlier on PATH is shadowing it. The which node / type -a node checks above will show you which. To switch and confirm in one go with nvm:

bash
nvm use --lts
node -v        # confirm it actually changed

For the full comparison of these managers and when to reach for each, see the version manager comparison.

Checking on Windows

The commands are the same in PowerShell and Command Prompt:

powershell
node --version
# v22.11.0

npm --version
# 10.9.0

The difference is locating the binary. which does not exist in stock Windows shells; use where.exe node (or Get-Command node in PowerShell):

powershell
where.exe node
# C:\Program Files\nodejs\node.exe

Get-Command node | Select-Object Source
# C:\Program Files\nodejs\node.exe

If node is not recognised right after an install, the PATH change has not reached your open terminal. Close it and open a fresh one. If it is still missing, the installer's "Add to PATH" step did not complete, and reinstalling from the official installer fixes it.

See also

FAQ

Sources

Authoritative references this article was fact-checked against.

TagsNode.jsJavaScriptnpmnvmfnmCLIVersion ManagementDevOps

Found this useful? Pass it on.

Copied

Ishan Karunaratne

Tech Architect · Software Engineer · AI/DevOps

Tech architect and software engineer with 20+ years building software, Linux systems, and DevOps infrastructure, and lately working AI into the stack. Currently Chief Technology Officer at a healthcare tech startup, which is where most of these field notes come from.

Keep reading

Related posts

How to Dockerize a Node.js App

A Dockerfile for a real Node.js app: multi-stage build, npm ci for deterministic dependencies, the node_modules-volume trick that makes bind-mounted source fast on Mac, and the non-root user that most tutorials skip.

How to Change a WordPress Password

Four reliable ways to change a WordPress password: admin dashboard, WP-CLI, directly in the database with the correct phpass or bcrypt hash, and the lost-password email reset.