c++ - 模块没有自行注册。使用使用 cmake-js 编译的自定义构建 c++ 节点模块的电子应用程序
问题描述
在一个项目上工作。为node构建了一个C++模块,用cmake编译。我尝试在我的主电子应用程序中使用该模块,但它出错了。
在这里用最小的 repo 复制它:https ://github.com/Aerrus/electronMinimal
App threw an error during load
Error: Module did not self-register.
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:160:31)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:722:18)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:160:31)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at Module.require (internal/modules/cjs/loader.js:640:17)
at require (internal/modules/cjs/helpers.js:20:18)
at bindings (C:\Users\xxx\electronMinimal\mods\node_modules\bindings\bindings.js:112:48)
at Object.<anonymous> (C:\Users\xxx\electronMinimal\mods\index.js:1:188)
已经看到很多关于重建它的线程,确保我构建它时的节点版本是相同的,等等。他们都没有改变任何东西。
解决方案
如果您使用的是电子 v4.0,请查看此内容。我希望它有所帮助,因为这就是我解决问题的方式
推荐阅读
- python - 重命名数据框列名
- angular - 如何修复“polyfills.js:61462 无法重新计算设备参数”。离子/角度应用中的错误
- javascript - safari ios 上的录音是空的
- c - 制作从 DS18B20 读取温度并显示在 LCD 上的功能
- c# - 由于无限循环,Unity 程序停止响应
- javascript - 如何使用相对路径生成单个 *.d.ts 或多个
- swift - Swift 字典内的值访问和更改(涉及数组的字典)
- r - 如何有条件地总结组中的其他条目 - R
- r - 在函数内部选择列的不同方法会导致不同的结果,为什么?
- c# - 将自定义 AABB 分配给游戏对象