我正在尝试为Electron创建一个简单的示例Native addon。但是,继续遇到此版本未命中匹配问题。我的电子项目和插件项目都有.nvmrc文件(使用节点7.4.0)。
错误
App threw an error during load
Error: The module '/Users/mikepriest/source/Browser/exambrowser-electron/app/native/prebuilt/addon/build/Release/native_rt.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 51. This version of Node.js requires
NODE_MODULE_VERSION 54. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or`npm install`).
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
at Object.Module._extensions..node (module.js:598:18)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/mikepriest/source/Browser/exambrowser-electron/app/main.dev.js:20:10)
at Object.<anonymous> (/Users/mikepriest/source/Browser/exambrowser-electron/app/main.dev.js:217:3)
尝试过的解决方案 1.尝试使用 ./node_modules/.bin/electron-rebuild 试图重建我的插件 nvm使用7.4.0 npm rebuild
仍然得到错误。
更新:找到了this post,但解决方案对我来说也不起作用。