Home·Terminal commands

node --version

Packages and runtimes

Usage

node --version | node -v

Prints the version of the node that comes first on PATH, which is why an editor terminal or a CI job can report a different one when a version manager is in play.

Common flags

FlagMeaning
-vthe same thing, shorter; prints e.g. v22.14.0
-p <expr>print one expression, e.g. node -p process.versions.v8
-e <code>run a line of code with no file
--env-file=<file>load a .env before running, from node 20.6
--helpevery flag this build accepts

Examples

node --version

the version of the node first on your PATH

node -p process.execPath

which binary that actually is, when several are installed

node -p process.versions.v8

the V8 version bundled with it

The question is always what goes where: inside this project, or on the whole machine.

How to read this

  • Square brackets [ ] mark a part you may leave out.
  • An ellipsis … means you can list more than one.
  • Flags are case-sensitive — in some commands -r and -R do different things.

Questions

Q. What does node --version do?

Prints the version of the node that comes first on PATH, which is why an editor terminal or a CI job can report a different one when a version manager is in play.

Q. How do I type it?

node --version | node -v — square brackets mark the parts you can leave out.

Q. How many flags are worth knowing?

5 are listed here; the full set is in man node. This command sits under Packages and runtimes.

Related commands

man page: man node---version