I want to get the version of Node.js on the command line. I'm expecting to run a command like:
node -version
but that doesn't work. Does anybody know what the command line would be? (i.e. not the REPL)
The command line for that is:
node -v
Or
node --version
Note:
If node -v
doesn't work, but nodejs -v
does, then something's not set up quite right on your system. See this other question for ways to fix it.
find the installed node version.
$ node --version
or
$ node -v
And if you want more information about installed node(i.e. node version,v8 version,platform,env variables info etc.)
then just do this.
$ node
> process
process {
title: 'node',
version: 'v6.6.0',
moduleLoadList:
[ 'Binding contextify',
'Binding natives',
'NativeModule events',
'NativeModule util',
'Binding uv',
'NativeModule buffer',
'Binding buffer',
'Binding util',
...
where The process object is a global that provides information about, and control over, the current Node.js process.
node --help
. But, in short, you need 2 dashes for full-name options:node --version
. A single dash starts a group of aliases, so-version
combines-v
,-e
,-r
, etc -- though only 3 of the 7 are recognized by Node. – Jonathan Lonowskinode --help
(node -h
works too). However,node
does not support grouping of options the way you describe; e.g.,node -p -i
works (syntactically - as of 0.12, no combination of short options makes sense semantically), butnode -pi
results in anunrecognized flag
/bad option
(0.12) error. – mklement0