electron Node.js版本相同,但gyp构建使用不同的NODE_MODULE_VERSION

xu3bshqb  于 2022-12-08  发布在  Electron
关注(0)|答案(1)|浏览(279)

我有这个项目node-libcurl-impersonate我已经运行了npx node-gyp rebuild并将输出移动到基于electron-react-boilerplate的其他项目
我已经将构建的dist从node-libcurl-impersonate移动到erb的主文件夹,并从那里使用了lib,它显示了以下错误

[electronmon] waiting for a change to restart it
App threw an error during load
Error: The module '/home/sonisins/prujekts/node/drivetest-tool/src/main/lib/node-libcurl/lib/binding/node_libcurl-impersonate.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 93. This version of Node.js requires
NODE_MODULE_VERSION 103. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at process.func [as dlopen] (node:electron/js2c/asar_bundle:5:1812)
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1199:18)
    at Object.func [as .node] (node:electron/js2c/asar_bundle:5:1812)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Module._load (node:internal/modules/cjs/loader:829:12)
    at Function.c._load (node:electron/js2c/asar_bundle:5:13343)
    at Function.Module._load (/home/sonisins/prujekts/node/drivetest-tool/node_modules/runtime-required/runtime-required.js:34:23)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/sonisins/prujekts/node/drivetest-tool/src/main/lib/node-libcurl/dist/Easy.js:5:18)
[electronmon] uncaught exception occured
[electronmon] waiting for any change to restart the app

examples/chrome-impersonate.js中的脚本在构建库后运行良好,但在电子项目中运行不好

ubbxdtey

ubbxdtey1#

https://www.electronjs.org/docs/v14-x-y/tutorial/using-native-node-modules
Electron支持原生Node.js模块,但由于Electron与给定的Node.js二进制文件具有不同的应用程序二进制接口(ABI)(由于使用Chromium的BoringSSL而不是OpenSSL等差异),因此您使用的原生模块需要针对Electron重新编译。否则,当您尝试运行应用时,您将收到以下错误类:

相关问题