0
致力于通过Node-Windows将PKG for Windows作为服务部署在应用程序中。将Utility应用程序部署为Windows服务NodeJS
我有我的NodeWindows安装和卸载脚本,我试图用PKG将它们制作成Windows可执行文件。 PKG创建.exe
文件,但是当我运行该文件,它抛出类似下面的错误:
PKG /前奏/ bootstrap.js:1226 回报wrapper.apply(this.exports,参数); ^
ReferenceError: svc is not defined
at Object.<anonymous> (C:\snapshot\transient\installTransient2.js:0)
at Module._compile (pkg/prelude/bootstrap.js:1226:22)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (pkg/prelude/bootstrap.js:1281:12)
at run (bootstrap_node.js:432:7)
at startup (bootstrap_node.js:192:9)
at bootstrap_node.js:547:3
与我的节点Windows脚本是这样的:
var Service = require('node-windows').Service;
var scv = new Service({
name: 'Transient2',
description: 'Yet Another File Transfer Utility in NodeJS',
script: 'server.js'
});
svc.on('install',() => {
console.log('successfully installed');
svc.start();
});
svc.install();
我想认为节点窗口中,无法装入可执行文件。根据PKG的文件,它应该在要求声明中“填充”任何东西,除非它声明为path.join()
呼叫。
如何将我的应用程序打包到在Windows中创建服务的安装程序中?
呵呵。我需要更好地发现那些 –