我正在尝试使用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)
并运行 …
我尝试将nodejs版本v6.x和edgejs版本v0.11开发的项目部署到生产环境node版本v.8.x中。。似乎出现错误“ Edge 模块尚未针对 Node.js 版本 v8.9.3 进行预编译”。
我用谷歌搜索他们建议降级节点js版本,但我不能因为服务器中已经运行的其他项目依赖节点v8.x。
我已将 Edgejs 更新为 ^7.10.1。但不工作。
对于下面的代码(使用EdgeJS模块),我想等待异步方法Start完成后再写sw.Elapsed,我该怎么做?
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using EdgeJs;
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
///
[STAThread]
static void Main()
{
// Application.EnableVisualStyles();
// Application.SetCompatibleTextRenderingDefault(false);
// Application.Run(new Form1());
Stopwatch sw =new Stopwatch();
sw.Start();
Task.Run((Action)Start).Wait();
//wait for start to complete --- how should I do it??
sw.Stop();
Console.WriteLine(sw.Elapsed);
}
public static async void Start()
{
var func = Edge.Func(@"
var esprima = require('esprima'); …Run Code Online (Sandbox Code Playgroud)