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

北慕城南 提交于 2020-12-15 07:53:31

问题


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.

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

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.


回答1:


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



来源:https://stackoverflow.com/questions/64815484/why-is-there-a-mismatch-of-module-versions-between-electron-and-node-js

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!