-
-
Notifications
You must be signed in to change notification settings - Fork 360
Open
Description
I have the following 'standard' service.js code (made some 'ugly' single liners to shorten code snippet).
const serviceConfig = packageJson.serviceConfig ?? {};
const host = serviceConfig.host ?? 'localhost';
const port = serviceConfig.port ?? 7801;
// Define the service
const svc = new Service({
name: 'KAT Camelot Highcharts Export Server',
description: 'Highcharts Export Server running as a Windows Service',
script: path.join(__dirname, 'node_modules', 'highcharts-export-server', 'bin', 'cli.js'),
nodeOptions: [
'--harmony',
'--max_old_space_size=4096'
],
env: [
{ name: "NODE_ENV", value: "production" },
{ name: "PUPPETEER_CACHE_DIR", value: path.join(__dirname, 'node_modules', '.puppeteer-cache') }
],
// Add arguments for host and port
scriptOptions: `--enableServer true --logToConsole false --logLevel 2 --noLogo true --host ${host} --port ${port}`
});
// Listen for the "install" event, which indicates the service is installed
svc.on('install', () => svc.start() );
svc.on('uninstall', () => console.log('Uninstall complete. The service exists: ', svc.exists));
svc.on('stop', () => console.log('The service has stopped.'));
svc.on('start', () => console.log('The service has started.'));
if (args.uninstall) svc.uninstall();
else if (args.stop) svc.stop();
else if (args.start) svc.start();
else svc.install();
When I install the service it reports success that the service has started, but it is not present in the Services snap-in, but service commands seem to behave as if all is ok.
Command flow
node service.js --install- Reports service is running.telnet 127.0.0.1 10447- Reports that it is unable to connect (proving that nothing is listening.node service.js --stop- Reports that service stopped.node service.js --start- Reports that service started.node service.js --uninstall- Reports successful uninstall.node service.js --uninstall- Run it a second time and reports that the service can not be found, implying that it was found and running in previous command.
Here are screen shots of the flow:
Things I Tried:
- I discovered that the exe was not even created in
D:\btr.services\HighchartsExportServer\node_modules\highcharts-export-server\bin\daemon, so I granted full permissions to the user logging in toD:\btr.services\HighchartsExportServer\and then when I ran--installit correctly created the file, but still same results as above. - I added
svc.on('invalidinstallation', () => console.log('The service was unable to install.'));(after already granting full permissions above) and never received this log. - I added
svc.on('error', e => console.log('Error:', e.message));and never recived this log. - Reading the code for
daemon.js startit looks like I should get some sort of error if I try starting the service vianode service.js --startmultiple times but I'm not getting any log there. Only the successful 'start' event. - I tried setting
allowServiceLogon: true(not really understanding what it would accomplish) in my service configuration and it didn't have an effect.
Given this information, any ideas of how to continue my debugging efforts of getting this working?
Metadata
Metadata
Assignees
Labels
No labels

