157

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

Carter Allen
  • 1,984
  • 15
  • 22
Lalith
  • 19,396
  • 17
  • 44
  • 54

13 Answers13

305

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

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

Mike
  • 14,010
  • 29
  • 101
  • 161
  • 2
    Agreed. This is also the only answer which works in Windows. All the single quote answers do nothing strangely... – Marc Dec 11 '12 at 20:27
  • 37
    ```node -p process.versions.v8``` is a bit shorter. Not that it matters, but maybe someone cares. – slikts Oct 02 '15 at 17:53
  • This answer is good, but [@Peter Dotchev's answer](https://stackoverflow.com/a/28213980/114558) is more useful – rinogo Dec 10 '20 at 00:00
137

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.

Mike
  • 14,010
  • 29
  • 101
  • 161
alienhard
  • 14,376
  • 9
  • 37
  • 28
  • 101
    or, you could just ask node which version is installed via process.versions. A little bit easier than hunting through the change log. `node -e 'console.log(process.versions.v8);'` – Ben Taber Apr 24 '12 at 16:10
  • when I type in "node --version" I don't get an error but I also don't get any information... just shows the prompt again. Any idea why? – geoidesic Sep 18 '16 at 22:05
  • The link is no longer updated, and as Ben Taber pointed out years ago, thankfully [there's a much more direct, straightforward way](https://stackoverflow.com/a/6655138/157247). – T.J. Crowder Jul 26 '17 at 11:47
  • This answer is good, but [@Peter Dotchev's answer](https://stackoverflow.com/a/28213980/114558) is more useful – rinogo Dec 10 '20 at 00:00
69

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' }
Peter Dotchev
  • 2,980
  • 1
  • 25
  • 19
  • 1
    Best answer to know. Also, NPM's CLI is a whackadoo-- if you add an argument onto this, it will increment the version in your package.json file, make and tag a git commit. Utterly bizarre UX, but this is useful. – mitchell_st Mar 02 '17 at 19:53
  • yours is the best answer of this question... Unfortunately I can only vote once.. Thanks – Daksh Gupta Sep 22 '17 at 14:49
  • Best answer of the bunch since it teaches a method that can be repeated for other packages. – rinogo Dec 09 '20 at 23:59
31

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
Ben Taber
  • 6,426
  • 1
  • 22
  • 17
  • 1
    +1, I had to use `node -e console.log(process.versions.v8)` though; nothing was being outputted otherwise. – pimvdb Apr 20 '12 at 20:21
  • Looks like that changed in node at some point, thanks for the tip. Edited the response to reflect that. – Ben Taber Apr 21 '12 at 14:53
14

You can just type:

node -p process.versions.v8

Gaui
  • 8,723
  • 16
  • 64
  • 91
9

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

Siyaram Malav
  • 4,414
  • 2
  • 31
  • 31
9

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.

9

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

:)

Mariano Iglesias
  • 1,877
  • 1
  • 13
  • 4
8
node -pe 'this.process.versions'     # all versions
node -pe 'this.process.versions.v8'  # v8 version
Vadim
  • 5,154
  • 2
  • 20
  • 18
  • 2
    A good answer will always have an explanation of what is being done and why it was done that way, not only for the OP but for future visitors to SO. – Jay Blanchard Sep 04 '15 at 20:15
  • Downvoting, because it adds nothing important to the most upvoted answer in this questions, which was posted 3 years ago. – Yaroslav Admin Sep 05 '15 at 09:42
  • 5
    How is this not adding anything important? It adds the correct, suggested by node, way to find out which version is used. https://nodejs.org/en/docs/es6/#how-do-i-find-which-version-of-v8-ships-with-a-particular-version-of-node-js – Philiiiiiipp Feb 06 '16 at 14:57
4

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
ZachB
  • 13,051
  • 4
  • 61
  • 89
0

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"

Geng Jiawen
  • 8,904
  • 3
  • 48
  • 37
0

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

cchamberlain
  • 17,444
  • 7
  • 59
  • 72
0

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>
Donghua Liu
  • 1,776
  • 2
  • 21
  • 30