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-versioncombines-v,-e,-r, etc -- though only 3 of the 7 are recognized by Node. - Jonathan Lonowskinode --help(node -hworks too). However,nodedoes not support grouping of options the way you describe; e.g.,node -p -iworks (syntactically - as of 0.12, no combination of short options makes sense semantically), butnode -piresults in anunrecognized flag/bad option(0.12) error. - mklement0