I'm a bit confused as to how Node.js gets access to libv8.

I downloaded the 64-bit "Linux Binaries (.tar.xz)" for version 6.5.0 of Node.js and extracted them to /opt on my Debian Linux machine. When I run node -e "console.log(process.versions.v8)", I get, which is the recent version of V8 I would expect to see running with Node 6.5.0. However, when I look at Synaptic Package Manager in Debian, its nodejs package has a dependency on the libv8-3.14.5 package; a much older version of V8.

So which is it - does Node use the installed libv8 (the package manager indicates that 3.14.5 is installed on my machine) or does V8 come bundled with Node.js? Is it compiled into the node binary? If so, why does the package manager have the libv8 dependency?


When you download Node.js from the download site, the binary you get is statically linked against libv8 There are a number of ways to verify this:

  • look for libv8 in the binary:

    strings bin/node | less -plibv8

    (this will lead you to the "" string in the binary)

  • list the symbols in the binary and unmangle them:

    nm bin/node | c++filt | less -pv8::

    (the v8:: symbols come from libv8).

The archive you downloaded doesn't use Debian's packaging system, so the package manager's dependencies don't come into consideration. If you didn't install the libv8-3.14.5 package explicitly, presumably some other package installed on your system depends on it. If nothing actually needs it, you can remove libv8-3.14.5 and you'll see that the node binary in /opt works fine without it.

In any case, even with a packaged version of Node.js you wouldn't necessarily see a dependency on libv8, because Node.js includes the source of the V8 engine; it's not a separate library (at least not for Node.js).

(To run the above commands, you'll need to install the binutils package for nm and c++filt.)

  • So the version of Node.js installed by the Debian repos isn't statically linked against libv8? – Jez Sep 10 '16 at 16:18
  • The packaged version of Node.js is statically linked against V8 too. In fact, Node.js includes the source code of the V8 engine, it isn't an external dependency (build or runtime). – Stephen Kitt Sep 10 '16 at 16:50
  • Interesting... checking it now, they've removed that libv8 dependency in sid. It was only still there in jessie. – Jez Sep 10 '16 at 18:10
  • 1
    Indeed, the change happened with the packaging of version 4: "Build using embedded cares, embedded v8, because Node.js is using patched versions of them and no longer allow building with shared system libraries of those." – Stephen Kitt Sep 10 '16 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.