Daniel Stephens
Daniel Stephens

Reputation: 3209

Why is there a mismatch of module versions between Electron and Node.JS?

I have a node project in which I use NodeJS 14.15.0 and the latest build of Electron 12.0.0.

NodeJS version 14.15.0 has a NODE_MODULE_VERSION 83 according to their webpage.

enter image description here

Electron version v12.0.0 uses this node version of 14.15.0. but on their webpage it says the module NODE_MODULE_VERSION is 87

enter image description here

Therefore I have a mismatch between these two versions. I need a match so I can load the same binary intro an Electron app + execute by a node.js instance.

Upvotes: 2

Views: 2285

Answers (1)

Sidney
Sidney

Reputation: 4775

Electron maintains and compiles their own fork of Node, in a way that may not be compatible with normal Node. Electron intentionally uses unique NODE_MODULE_VERSION to signal this fact to software.

You'll need to recompile native modules using electron-rebuild.

Native Node modules are supported by Electron, but since Electron is very likely to use a different V8 version from the Node binary installed on your system, the modules you use will need to be recompiled for Electron.

(electron docs)

The maintainers of Node and Electron discussed possible options, and decided to use offset versioning in this issue:

https://github.com/nodejs/TSC/issues/651

Upvotes: 5

Related Questions