如何检查我的 NodeJS 安装了哪个版本的 v8?

发布于 2024-10-23 19:56:48 字数 43 浏览 1 评论 0原文

V8 如何与 NodeJs 一起安装?我当前的 V8 发动机是什么版本?

How is V8 installed along with NodeJs? What version is my current V8 engine?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(13

内心荒芜 2024-10-30 19:56:48

一站式解决方案:
node -p process.versions.v8

替代解决方案:
节点-e“console.log(process.versions.v8)”

One-line solution:
node -p process.versions.v8

Alternative solution:
node -e "console.log(process.versions.v8)"

简单方法:
在命令行中输入:node -p process.versions.v8

困难方法:

  1. 输入node --version以获取 Node.js 文件。 js版本。

  2. 转到 Node.js 变更日志

  3. 查找并打开适当的 Node.js 版本更改日志。

  4. 查找包含V8 to的注释。

Easy way:
Type in command line: node -p process.versions.v8

Hard way:

  1. Type node --version to get the Node.js version.

  2. Go to the Node.js Changelogs.

  3. Find and open an appropriate Node.js version change log.

  4. Look for notes containing V8 to.

泛滥成性 2024-10-30 19:56:48

只需运行 npm version (不知道从什么时候开始可用)

> npm version
{ http_parser: '1.0',
  node: '0.10.35',
  v8: '3.14.5.9',
  ares: '1.9.0-DEV',
  uv: '0.10.30',
  zlib: '1.2.8',
  modules: '11',
  openssl: '1.0.1j',
  npm: '1.4.28',
  xsjs: '0.1.5' }

Just run npm version (don't know since when this is available)

> npm version
{ http_parser: '1.0',
  node: '0.10.35',
  v8: '3.14.5.9',
  ares: '1.9.0-DEV',
  uv: '0.10.30',
  zlib: '1.2.8',
  modules: '11',
  openssl: '1.0.1j',
  npm: '1.4.28',
  xsjs: '0.1.5' }
洋洋洒洒 2024-10-30 19:56:48

要检查您的版本,请检查 REPL 中 process.versions 中的值。

node -e "console.log(process.versions.v8);"

此外,如果需要,您可以使用其他版本的 V8 来编译节点。显然,根据您选择的版本,结果可能会有很大差异。

cd node-v0.x.x
rm -rf deps/v8
git clone http://github.com/v8/v8.git deps/v8

./configure
make
make install

To check your version, check the value in process.versions in the REPL.

node -e "console.log(process.versions.v8);"

Additionally, you can compile node with other versions of V8 if you desire. Obviously results may vary widely here depending on what versions you choose.

cd node-v0.x.x
rm -rf deps/v8
git clone http://github.com/v8/v8.git deps/v8

./configure
make
make install
栖迟 2024-10-30 19:56:48

您只需输入:

node -p process.versions.v8

You can just type:

node -p process.versions.v8

追星践月 2024-10-30 19:56:48

只是为了好玩,如果您的终端中可以使用curl,则以下内容应该为您提供v8的版本:

V=`cat /usr/include/node/node_version.h | grep -E '^\#define NODE_(MAJOR|MINOR|PATCH)_VERSION' | sed -e 's/^[^0-9]*//'`; V=`echo $V | sed -e 's/ /\./g'`; URL=https://github.com/joyent/node/raw/v$V/ChangeLog; curl --silent $URL | grep 'Upgrade v8' | head -1 | sed -e 's/^.* //'; unset V; unset URL

例如,在我的node.js 0.4.7框中,我得到:

3.1.8.10

:)

Just for fun, if you have curl available in your terminal, the following should give you v8's version:

V=`cat /usr/include/node/node_version.h | grep -E '^\#define NODE_(MAJOR|MINOR|PATCH)_VERSION' | sed -e 's/^[^0-9]*//'`; V=`echo $V | sed -e 's/ /\./g'`; URL=https://github.com/joyent/node/raw/v$V/ChangeLog; curl --silent $URL | grep 'Upgrade v8' | head -1 | sed -e 's/^.* //'; unset V; unset URL

For example, in my box with node.js 0.4.7 I get:

3.1.8.10

:)

故事与诗 2024-10-30 19:56:48

使用node.js找到已安装的v8版本。

$ node
> process.versions.v8
'5.1.281.83'
>

其中 process 对象是一个全局对象,它提供有关当前 Node.js 进程的信息并对其进行控制。

如果您只是在node repl中输入process,您会看到有关node的信息(即node版本,v8版本,平台,env变量信息等)

find the installed v8 version with node.

$ node
> process.versions.v8
'5.1.281.83'
>

where The process object is a global that provides information about, and control over, the current Node.js process.

if you just type process in node repl, you see information about node(i.e. node version,v8 version,platform,env variables info etc.)

以可爱出名 2024-10-30 19:56:48

如果您使用的是 Node.js 版本 7.7.3 或类似版本,则命令是

$ node -p "process.versions"

但上面的命令也可以正常工作。

If you're on Node.js version 7.7.3 or similar the command is

$ node -p "process.versions"

But those above work fine too.

夜吻♂芭芘 2024-10-30 19:56:48
node -pe 'this.process.versions'     # all versions
node -pe 'this.process.versions.v8'  # v8 version
node -pe 'this.process.versions'     # all versions
node -pe 'this.process.versions.v8'  # v8 version
软的没边 2024-10-30 19:56:48

其他答案非常适合检查您当前的版本。这里还有一个包含所有 Node.js 版本的表格: https://nodejs.org/en/download /发布/。摘录例如:

Version             Date        V8          npm     NODE_MODULE_VERSION
Node.js 11.0.0      2018-10-23  7.0.276.28  6.4.1   67
Node.js 10.13.0     2018-10-30  6.8.275.32  6.4.1   64
Node.js 10.12.0     2018-10-10  6.8.275.32  6.4.1   64

The other answers are great for checking your current version. There's also a table with all Node.js versions here: https://nodejs.org/en/download/releases/. Excerpt for example:

Version             Date        V8          npm     NODE_MODULE_VERSION
Node.js 11.0.0      2018-10-23  7.0.276.28  6.4.1   67
Node.js 10.13.0     2018-10-30  6.8.275.32  6.4.1   64
Node.js 10.12.0     2018-10-10  6.8.275.32  6.4.1   64
徒留西风 2024-10-30 19:56:48

更新:

C:\Users\Liu.D.H>C:\Users\Liu.D.H\AppData\Roaming\nvm\v16.14.2\node -p process.versions
{
  node: '16.14.2',
  v8: '9.4.146.24-node.20',
  uv: '1.43.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '93',
  nghttp2: '1.45.1',
  napi: '8',
  llhttp: '6.0.4',
  openssl: '1.1.1n+quic',
  cldr: '40.0',
  icu: '70.1',
  tz: '2021a3',
  unicode: '14.0',
  ngtcp2: '0.1.0-DEV',
  nghttp3: '0.1.0-DEV'
}

C:\Users\Liu.D.H>nvm use 18.0.0
Now using node v18.0.0 (64-bit)

C:\Users\Liu.D.H>node -p process.versions
{
  node: '18.0.0',
  v8: '10.1.124.8-node.13',
  uv: '1.43.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '108',
  nghttp2: '1.47.0',
  napi: '8',
  llhttp: '6.0.4',
  openssl: '3.0.2+quic',
  cldr: '41.0',
  icu: '71.1',
  tz: '2022a',
  unicode: '14.0',
  ngtcp2: '0.1.0-DEV',
  nghttp3: '0.1.0-DEV'
}

C:\Users\Liu.D.H>

Updated:

C:\Users\Liu.D.H>C:\Users\Liu.D.H\AppData\Roaming\nvm\v16.14.2\node -p process.versions
{
  node: '16.14.2',
  v8: '9.4.146.24-node.20',
  uv: '1.43.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '93',
  nghttp2: '1.45.1',
  napi: '8',
  llhttp: '6.0.4',
  openssl: '1.1.1n+quic',
  cldr: '40.0',
  icu: '70.1',
  tz: '2021a3',
  unicode: '14.0',
  ngtcp2: '0.1.0-DEV',
  nghttp3: '0.1.0-DEV'
}

C:\Users\Liu.D.H>nvm use 18.0.0
Now using node v18.0.0 (64-bit)

C:\Users\Liu.D.H>node -p process.versions
{
  node: '18.0.0',
  v8: '10.1.124.8-node.13',
  uv: '1.43.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '108',
  nghttp2: '1.47.0',
  napi: '8',
  llhttp: '6.0.4',
  openssl: '3.0.2+quic',
  cldr: '41.0',
  icu: '71.1',
  tz: '2022a',
  unicode: '14.0',
  ngtcp2: '0.1.0-DEV',
  nghttp3: '0.1.0-DEV'
}

C:\Users\Liu.D.H>
风透绣罗衣 2024-10-30 19:56:48

您还可以使用 docker 检查任何 NodeJS v8 版本,例如 Node 10.7.0
<代码>
docker run --rm -it node:10.7.0 bash -c "node -p process.versions"

You can also checking any nodejs v8 version using docker, like node 10.7.0 :

docker run --rm -it node:10.7.0 bash -c "node -p process.versions"

时光礼记 2024-10-30 19:56:48

v8 与 Node.js 捆绑在一起。您可以通过查看 node 存储库中的 v8 ChangeLog 来了解任何版本的 Node.js 使用的 v8 版本以及它何时投入生产。这是当前的主版本(如果从源代码构建):
https://github.com/nodejs/node/commits/master/ deps/v8/ChangeLog

要查看特定版本的 Node.js,请将分支切换到该版本并检查 ChangeLog 的文件历史记录。

Node. js更改日志历史

v8 is bundled with Node.js. You can see what version of v8 any version of Node.js is using and when it went into production by viewing the v8 ChangeLog from the node repository. This is current master (if building from source):
https://github.com/nodejs/node/commits/master/deps/v8/ChangeLog

To view for a specific version of Node.js, switch the branch to that version and check the ChangeLogs file history.

Node.js change log history

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文