查询Electron的NODE_MODULE_VERSION

林一二2021年10月27日 23:44
Ref: https://github.com/JoshuaWise/better-sqlite3/issues/704
Keywords:

https://github.com/nodejs/node/blob/master/doc/abi_version_registry.json能看到具体的数字。

https://nodejs.org/en/download/releases/搜,能看到大致的数字,而实际的版本会有差别。

可以看到,这里的 ABI 有 Electron 的专门版本号,Electron v15(NodeJS 16)对应的版本号和 NodeJS 16 的是不一样的:

{ "modules": 98, "runtime": "electron", "variant": "electron",             "versions": "15" },
{ "modules": 93, "runtime": "node",     "variant": "v8_9.0",               "versions": "16.0.0" },

要解决 Electron 上的问题,就需要使用真的 Electron 构建的包,而不能直接用对 NodeJS 构建的。

# Error: The module '//TiddlyGit-Desktop/node_modules/opencv4nodejs-prebuilt/build/Release/opencv4nodejs.node'
# was compiled against a different Node.js version using
# NODE_MODULE_VERSION 93. This version of Node.js requires
# NODE_MODULE_VERSION 98. Please try re-compiling or re-installing
# the module (for instance, using `npm rebuild` or `npm install`).