149
votes

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

12

12 Answers

130
votes

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.

297
votes

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

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

66
votes

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' }
31
votes

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
13
votes

You can just type:

node -p process.versions.v8

9
votes

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

:)

9
votes

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.)

9
votes

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.

8
votes
node -pe 'this.process.versions'     # all versions
node -pe 'this.process.versions.v8'  # v8 version
4
votes

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
0
votes

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"

0
votes

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