命令行上的 Node.js 版本?(不是 REPL)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14888471/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Node.js version on the command line? (not the REPL)
提问by hawkeye
I want to get the version of Node.js on the command line. I'm expecting to run a command like:
我想在命令行上获取 Node.js 的版本。我期待运行如下命令:
node -version
but that doesn't work. Does anybody know what the command line would be? (i.e. not the REPL)
但这不起作用。有人知道命令行是什么吗?(即不是 REPL)
回答by JohnnyHK
The command line for that is:
其命令行是:
node -v
Or
或者
node --version
Note:
笔记:
If node -vdoesn't work, but nodejs -vdoes, then something's not set up quite right on your system. See this other questionfor ways to fix it.
如果node -v不起作用,但nodejs -v确实起作用,则说明您的系统上的某些设置不正确。有关修复方法,请参阅此其他问题。
回答by Austin Mullins
If you're referring to the shell command line, either of the following will work:
如果您指的是 shell 命令行,则以下任一方法都可以使用:
node -v
node --version
Just typing node versionwill cause node.js to attempt loading a module named version, which doesn't exist unless you like working with confusing module names.
只需键入node version将导致 node.js 尝试加载名为 version 的模块,除非您喜欢使用令人困惑的模块名称,否则该模块不存在。
回答by Srilu
Try nodejsinstead of just node
尝试 nodejs而不是仅仅node
$ nodejs -v
v0.10.25
回答by Srilu
If you want to check in command prompt use node -v or node --version
如果要检查命令提示符,请使用 node -v 或 node --version
v6.9.5
If u have node.exe then in node you can give.
如果你有 node.exe 那么在节点中你可以给。
>process
process {
title: 'node',
version: 'v6.9.5',
.......
回答by imrek
Node:
节点:
node --versionor node -v
node --version或者 node -v
npm:
纳米:
npm --versionor npm -v
npm --version或者 npm -v
V8 engine version:
V8引擎版本:
node -p process.versions.v8
回答by muthukumar helius
Repl Command to find the Nodejs Version
用于查找 Nodejs 版本的 Repl 命令
$node
>process.version
`v8.x`
回答by Siyaram Malav
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.)
如果您想了解有关已安装节点的更多信息(即节点版本、v8 版本、平台、环境变量信息等)
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.
其中 process 对象是一个全局对象,它提供有关当前 Node.js 进程的信息并对其进行控制。
回答by Neeraj Kumar
You can check if you have Node and Npm installed by typing:
您可以通过键入以下内容来检查是否安装了 Node 和 Npm:
$node --version && npm --version
$node --version && npm --version
回答by Jatin Malwal
By default node package is nodejs, so use
默认节点包是 nodejs,所以使用
$ 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


