我们正在尝试将Node JS应用程序作为服务安装在其中一台服务器上,但当我们运行下面的脚本时,它不会创建windows服务。但是,我们能够使用相同脚本在另一台服务器上创建windows服务。
var Service = require('node-windows').Service;
console.log(" entered ");
// Create a new service object
var svc = new Service({
name:'NodeJS App New',
description: 'Node JS Application which converts Html String to PDF',
script: 'S:\\HtmlToPdf\\MainApp.js',
wait: 2,
grow: .5
});
console.log(" entered 2 ");
console.log(" entered 3");
// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on('install',function(){
console.log(" entered install ");
svc.start();
});
svc.install();
console.log(" completed ");发布于 2020-02-28 03:19:59
在删除服务名称中的空格后,它可以正常工作,如下所示
name:'NodeJSAppNew',https://stackoverflow.com/questions/60430535
复制相似问题