Node.js version on the command line? (not the REPL

2019-01-16 01:23发布

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? (ie not the REPL)

10条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-01-16 02:03

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.

查看更多
别忘想泡老子
3楼-- · 2019-01-16 02:06

Try nodejs instead of just node

$ nodejs -v
v0.10.25
查看更多
趁早两清
4楼-- · 2019-01-16 02:07

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.

查看更多
【Aperson】
5楼-- · 2019-01-16 02:07

Repl Command to find the Nodejs Version

$node
>process.version
`v8.x`
查看更多
霸刀☆藐视天下
6楼-- · 2019-01-16 02:09

Node:

node --version or node -v

npm:

npm --version or npm -v

V8 engine version:

node -p process.versions.v8
查看更多
做个烂人
7楼-- · 2019-01-16 02:09

You can check if you have Node and Npm installed by typing:

$node --version && npm --version

查看更多
登录 后发表回答