我正在尝试使用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)
并运行 …