13

I have seen countless articles on how to use NSSM (http://nssm.cc/) to start a NodeJS process.

So, I have the following simple NodeJS file:

var http = require('http');
http.createServer(function (req, res) {
    res.writeHead(200, { 'Content-Type': 'text/html' });
    res.end('<p>Hello World</p>');
}).listen(8000);

console.log('Server running on http://localhost:8000/');

I am using this command to install the NodeJS file as a windows service:

"C:\Program Files\SimpleNode\nssm.exe" install SimpleNode "C:\Program Files\SimpleNode\node.exe" "C:\Program Files\SimpleNode\simple.js"

The service is installed. When I start it I get an error message, the services is in the Paused state and I see the following error in Event Viewer:

GetProcessTimes() failed: The handle is invalid.

This should be pretty simple. I have tried using a domain account that has local admin rights. I have tried a couple of different port numbers. The app does work correctly when I start it from the command line.

MORE NOTES: This is running on 64-bit Windows 2008 R2 server. I have made sure I am running all 64-bit executables for both NSSM and Node. I have also tried using 32-bit executables for both.

Can anyone tell me what I am missing? Can someone else replicate this issue?

3 Answers 3

16

Found the issue.

The problem is that is that the path to the simple.js file has a space in it (Good Old "Program Files"). You have to escape the quotes with a backslash for NSSM to interpret it correctly. The correct installation command line is:

"C:\Program Files\SimpleNode\nssm.exe" install SimpleNode "C:\Program Files\SimpleNode\node.exe" \"C:\Program Files\SimpleNode\simple.js\"

0

It sounds like you don't have access to ports for some reason. try setting the service to run as administrator (server Manager>Services>Servicename on windows server 2008) and see what happens.

2
  • No, I have tried that. I will edit my question with some of the things that I have tried.
    – Rob Cannon
    May 7, 2013 at 21:07
  • weird, when I had a similar issue (windows server 2008) this worked
    – legacy
    May 7, 2013 at 21:08
-2

NSSM usually works fine with Node.js so this is probably a permissions issue. Review this tutorial showing how to setup Node.js with our commercial application to troubleshoot. And feel free to use the 30-day trial too as it it may return a more helpful error message indicating what the problem is.

1
  • AlwaysOn made me use the 32-bit version of Node.exe. And that works with AlwaysOn. I made sure that I had the 32-bit version of both NSSM and Node and it still gives me the same issue.
    – Rob Cannon
    May 9, 2013 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.