669

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)

Penny Liu
  • 11,885
  • 5
  • 66
  • 81
hawkeye
  • 33,004
  • 28
  • 141
  • 288
  • The different answers suggest completely different questions. – hawkeye Feb 15 '13 at 04:59
  • 1
    Yes, the runtime question works for the Node command line, not the shell. Of course, "command line" could refer to either thing. – Austin Mullins Feb 15 '13 at 05:01
  • 8
    Check `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 Lonowski Feb 15 '13 at 05:08
  • @JonathanLonowski: Good to know about `node --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), but `node -pi` results in an `unrecognized flag` / `bad option` (0.12) error. – mklement0 Mar 08 '15 at 03:56
  • [This](https://stackoverflow.com/a/41814019/1042705) may help somebody! – Irf Jan 01 '19 at 07:05

14 Answers14

1170

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.

Community
  • 1
  • 1
JohnnyHK
  • 290,447
  • 61
  • 595
  • 453
87

If you're referring to the shell command line, either of the following will work:

node -v

node --version

Just typing node version will cause node.js to attempt loading a module named version, which doesn't exist unless you like working with confusing module names.

Austin Mullins
  • 7,099
  • 2
  • 32
  • 47
  • 4
    You're welcome. Note, however, that the OP typed `node -version`, not `node version`. The former reports an `unrecognized flag` / `bad option` (in 0.12) error and then enters the REPL, whereas the latter indeed tries to load a non-existent file, and aborts without entering the REPL. @JonathanLonowski has already stated it in a comment on the question, but let me repeat it here: `node -h` or `node --help` shows all supported command-line options. – mklement0 Mar 08 '15 at 03:38
41

Try nodejs instead of just node

$ nodejs -v
v0.10.25
mklement0
  • 312,089
  • 56
  • 508
  • 622
Srilu
  • 425
  • 4
  • 4
  • 8
    Note: The node.js executable (binary) should be `node`, not `nodejs`. However, there was a naming conflict on some Linux distros (e.g., Ubuntu), resulting in the executable getting installed as `nodejs`. As of Ubuntu 14.04, for instance, `apt-get install nodejs` will _also_ install executable `node` (implemented as a symlink to `nodejs`). In other words: For consistency, _try `node -v` first_. – mklement0 Mar 08 '15 at 04:10
19

If you want to check in command prompt use node -v or node --version

v6.9.5

If u have node.exe then in node you can give.

>process
process {
  title: 'node',
  version: 'v6.9.5',
  .......
  • 2
    If you have `node.exe`, then `>process.version` will only show the version and not the full process object – JFK Mar 09 '17 at 21:45
19

Just type npm version in your command line and it will display all the version details about node, npm, v8 engine etc.

enter image description here

Himanshu
  • 5,903
  • 1
  • 14
  • 9
15

Repl Command to find the Nodejs Version

$node
>process.version
`v8.x`
13

Node:

node --version or node -v

npm:

npm --version or npm -v

V8 engine version:

node -p process.versions.v8
imrek
  • 2,672
  • 3
  • 16
  • 34
10

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.

Siyaram Malav
  • 3,640
  • 1
  • 28
  • 28
7

Write this command to check the version of node.js

node --version
khawar
  • 106
  • 1
  • 4
6

By default node package is nodejs, so use

$ nodejs -v

or

$ nodejs --version 

You can make a link using

$ sudo ln -s /usr/bin/nodejs /usr/bin/node

then u can use

$ node --version

or

$ node -v
Jatin Malwal
  • 4,887
  • 2
  • 22
  • 26
4

One cool tip if you are using the Atom editor.

$ apm -v
apm  1.12.5
npm  3.10.5
node 4.4.5
python 2.7.12
git 2.7.4

It will return you not only the node version but also few other things.

prosti
  • 35,325
  • 9
  • 162
  • 139
  • 3
    apm -v will tell you the version of node and npm that Atom is using. It may not necessarily be the one that will be if you are using the command line – Hello Universe May 11 '17 at 02:30
2

For Node Js version -

node -v

Or

node --version

For NPM version -

npm -v

or

npm -version

in windows os we can't use nodejs -v, it doesn't work.

1

On an Arm7 (armhf) device running Debian Stretch, I had to issue either of the following:

$ nodejs -v
$ nodejs -h

The following did not work:

$ node -v
$ node -h
$ apm -v

Hope this helps someone else.

Fiddy Bux
  • 624
  • 9
  • 21
0
  1. Open Command line prompt
  2. node -v