【发布时间】:2017-05-06 07:50:03
【问题描述】:
我正在尝试使用 edge.js 执行一些 .NET 代码以在 Electron 应用程序的窗口上打印。我已经尝试过electron-edge,并且我还尝试在instructions in the Electron docs 之后手动构建针对 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)
我检查了文件系统,edge_nativeclr.node 模块确实存在。我怀疑我在某种程度上没有正确构建模块,它可能仍然针对错误版本的节点,因此电子无法导入模块。
我尝试了几种不同的方法,包括按照electron-edge's steps 手动更新build.bat 并将--target=1.4.12 --dist-url=https://atom.io/download/atom-shell 标志添加到node-gyp configure build。
我还在.npmrc 中设置了以下 npm 配置选项:
target=1.4.12
arch=x64
target_arch=x64
disturl=https://atom.io/download/electron
runtime=electron
build_from_source=true
msvs_version=2015
并运行build.bat,确保将EDGE_NATIVE环境变量设置为指向生成的edge_nativeclr.node文件,但得到了相同的结果。
【问题讨论】:
-
您是否再次确保案例相同?
-
@Mike'Pomax'Kamermans - 路径中的情况?是的,都是小写的。
标签: node.js electron node-gyp edgejs