coreybutler / node-windows

Windows support for Node.JS scripts (daemons, eventlog, UAC, etc).
Other
2.79k stars 358 forks source link

Windows installation service was not successful #237

Closed zhoub1994 closed 5 years ago

zhoub1994 commented 5 years ago

Windows10 environment. Running install does not follow the service, and the install listener function is not executed. The same is true on server 2008.

const svc = new Service({
  name: CONFIG.ServiceName,
  description: 'this is description',
  script: path.join(__dirname, 'index.js')
})
svc.on('install', () => {
  svc.start();
})

if (svc.exists) {
  console.log(`${CONFIG.ServiceName}!`);
  svc.restart();
} else {
  svc.install();
}
// svc.install();
// console.log(svc.exists)

This is the relevant code.

Eromonsele commented 5 years ago

@CheiZhei Please did you find a solution to this??