Issue:
When using svc.install(); the service fails to install in Windows 11 without any warning or error.
How To Reproduce:
- Start with a blank Windows 11 environment (e.g. use "Windows Sandbox")
- Install node
- Create project with
npm install node-windows
- Run sample service install script
var Service = require('node-windows').Service;
// Create a new service object
var svc = new Service({
name:'Hello World',
description: 'The nodejs.org example web server.',
script: 'C:\\path\\to\\helloworld.js',
nodeOptions: [
'--harmony',
'--max_old_space_size=4096'
]
//, workingDirectory: '...'
//, allowServiceLogon: true
});
// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on('install',function(){
svc.start();
});
svc.install();
Expected Behavior:
Service is installed.
Or, error is emitted.
Actual Behavior:
Service is not installed.
Even adding an error event handler, there is no error emitted.
svc.on('install',function(){
svc.start();
});
svc.on('error', (err) => {
console.log(err)
})
svc.install();
Desktop:
Windows 11 22H2

Additional context:
I believe the issue is related to the very old version of winsw.exe bundled with the project. https://github.com/coreybutler/node-windows/tree/master/bin/winsw
If I try to run winsw.exe directly (but providing it a sample .xml to install a service), it fails. However if I use a newer version of winsw.exe from https://github.com/winsw/winsw/releases/tag/v2.12.0 then the service is installed correctly.
I believe this PR attempting to upgrade WinSW #268 might address this issue (EDIT: Nope, unfortunately that version of WinSW doesn't work either. I tested 2.12.0 directly and works https://github.com/winsw/winsw/releases/tag/v2.12.0.
Issue:
When using
svc.install();the service fails to install in Windows 11 without any warning or error.How To Reproduce:
npm install node-windowsExpected Behavior:
Service is installed.
Or, error is emitted.
Actual Behavior:
Service is not installed.
Even adding an error event handler, there is no error emitted.
Desktop:
Windows 11 22H2
Additional context:
I believe the issue is related to the very old version of
winsw.exebundled with the project. https://github.com/coreybutler/node-windows/tree/master/bin/winswIf I try to run
winsw.exedirectly (but providing it a sample.xmlto install a service), it fails. However if I use a newer version ofwinsw.exefrom https://github.com/winsw/winsw/releases/tag/v2.12.0 then the service is installed correctly.I believe this PR attempting to upgrade WinSW #268
might address this issue(EDIT: Nope, unfortunately that version of WinSW doesn't work either. I tested 2.12.0 directly and works https://github.com/winsw/winsw/releases/tag/v2.12.0.