我正在使用 node-windows 安装和卸载节点后端 RESTAPI windows 服务。安装时它工作得很好。但是当我尝试卸载该服务时,它会导致问题。下面是卸载windows节点服务的代码,我还附上了错误的截图
var Service = require('node-windows').Service;
var config = require('./config.json');
// pre-Installation
/**
* npm install - g node- windows
* npm link node-windows
*/
// Create a new service object
var svc = new Service({
name: 'GRIT Node Server',
description: 'The new Node.js based GRIT Server',
script: config.absoluteProgramDirectory,
nodeOptions: [
'--harmony'
]
});
// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on('install', () => {
svc.start();
});
console.log('program sucessfully uninstalled');
svc.uninstall();