Dou*_*low 16 node.js node-gyp electron edgejs
我正在尝试使用edge.js来执行一些.NET代码,以便在Electron应用程序的Windows上打印.我已经尝试了电子边缘,我也尝试按照Electron文档中的说明手动构建针对Electron的edge.js模块,但是当我尝试在打包的应用程序中使用edge时,我不断收到以下错误:
Error: The specified module could not be found.
\\?\C:\path\to\app\app-1.0.0\resources\app.asar.unpacked\node_modules\edge\lib\native\win32\x64\6.5.0\edge_nativeclr.node
at Error (native)
at process.module.(anonymous function) (ELECTRON_ASAR.js:178:20)
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:178:20)
at Object.Module._extensions..node (module.js:583:18)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:192:18)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
Run Code Online (Sandbox Code Playgroud)
我已经检查了文件系统edge_nativeclr.node,事实上,模块确实存在.我的怀疑是我不知道是不是正确构建模块,它可能仍然针对节点的错误版本,因此电子无法导入模块.
我尝试了几种不同的方法,包括按照电子边缘的步骤手动更新build.bat并将--target=1.4.12 --dist-url=https://atom.io/download/atom-shell标志添加到node-gyp configure build.
我还在我的设置中设置了以下npm配置选项.npmrc:
target=1.4.12
arch=x64
target_arch=x64
disturl=https://atom.io/download/electron
runtime=electron
build_from_source=true
msvs_version=2015
Run Code Online (Sandbox Code Playgroud)
并运行build.bat,确保将EDGE_NATIVE环境变量设置为指向生成的edge_nativeclr.node文件,但得到相同的结果.
Dou*_*low 25
我终于在把头撞到键盘上几天之后弄明白了.我得到了一些提示,electron-userland/electron-packager#217并electron/electron#892指出当本机模块缺少依赖项(如a)时可能会发生此错误"无法找到指定的模块" .dll,并且您可以使用Dependency Walker检查依赖项任何给定的.node模块.
我edge_nativeclr.node在Dependency Walker中加载并注意到,VCRUNTIME140.DLL缺少Visual Studio 2015 C运行时.Edge.js附带msvcr120.dll了Visual Studio 2013 C运行时,但我一直在使用msvs_versionset 重建模块到2015.
一旦我将副本放在vcruntime140.dll同一目录中edge_nativeclr.node,一切都按预期开始工作.
| 归档时间: |
|
| 查看次数: |
9661 次 |
| 最近记录: |