Nurbol Alpysbayev
Nurbol Alpysbayev

Reputation: 21851

Can I change v8 version used by node.js?

I am writing a node.js C++ addon and it behaves differently in two identical node.js versions but with different v8 versions. So I want to make the v8 versions identical as well to see if the different v8 versions causes the different behavior.

To reproduce this, you could open VSCode's "about" and see there node.js and V8 version. The v8 version of VSCode's V8 is different (and ends with -electron) from what is used in the regular node.js of the same version (node -p process.versions.v8, ends with -node).

In my case I have these versions:

Upvotes: 2

Views: 405

Answers (1)

jmrk
jmrk

Reputation: 40491

V8 developer here. For the record and future searchers: V8, in general, does not promise API or ABI stability between versions, so by default, a given Node.js version (just like any other V8 embedder, e.g. Chromium-based browsers) is compatible with exactly one V8 version.

That said:

  • the required changes to adapt to a new API version are usually fairly small and straightforward; but they do require you to change some C++ code and recompile Node. (There have been a few exceptions over the past decade, where significant work was required.)
  • sometimes we (V8 team) have a reason to make an exception and actually guarantee ABI stability over a small range of versions. IIRC around the release of Node 10 was such a time; 6.8 and/or 6.9 may well have been in that range, I'm not sure.
  • sometimes you might get lucky: nothing significant has changed, and an earlier or later version just works :-)

In the case at hand, I agree with @PatrickRoberts' suggestion that debugging is probably more useful than bisecting.

Upvotes: 3

Related Questions