0

A basic node.js Implementation of a websocket server runs fine as when started via the command line or the scheduled task manager.

However, after being installed as a service using nssm, it refuses to launch with the following exception:

windows could not start the service ... on local computer. The service did not return an error. This could be an internal Windows error or an internal service error.

The software does use neither mapped network drives nor does it access the registry, both of which where implied as possibly reasons for this behavior in this SO question. I've traced the problem to be rooted within the websocket server component, commenting it out enables the running of the service just fine.

Additionally, the process works fine when being used in Windows 7 and Windows 10 environments.

When I'm mistaken in thinking this questions should be addressed to the serverfault community, feel free to move it to superuser.

Update:

Here's the referenced code element:

Instantiation:

    let WebSocket = require('ws');
    this.server = new WebSocket.Server({
        port: this.port
    });

This is a call to js library available on https://github.com/websockets/ws

1 Answers1

1

Funny, your code gives me no problems when I replace this.port with an integer. Otherwise it returns the same error, as the app obviously returns a TypeError exception. You say your code runs fine from the command line, but something is odd.

To say more, we need to know the NSSM configuration in detail. This is my working configuration:

enter image description here

To further debug your issue, enable logging and look into the log files. I strongly suspect your app throws an exception somewhere.

enter image description here

Daniel
  • 6,780
  • 5
  • 31
  • 60
  • This is weird. I overlooked the I/O redirection settings until your post and was looking forward to seeing some error output. Enabling stdout to file causes the app to run without problems, even though the WebSocket server itself does not log to the console and previous statements that cause console output were previously left included and did not cause a crash. While I still don't exactly know the cause of the problem, I'm happy enough for the hint. Thank you! – Jens Habegger Dec 01 '16 at 11:36