jfromaniello / winser

Run a node.js application as a window service using nssm.
270 stars 47 forks source link

npm start does not work on Windows Server 2012 #28

Closed johnsoftek closed 10 years ago

johnsoftek commented 10 years ago

When I use the defaults, npm start does not work. The service pauses immediately.

Starting node directly does work.

"install-windows-service": "winser -i --startcmd=\"node server.js\"",
PSyton commented 10 years ago

Service installed and paused? Or doesn't start when you start it? For start after instal '-a' flag needed.

johnsoftek commented 10 years ago

It pauses immediately after being started.

On 16 August 2014 15:25, Pavel V. Sysolyatin notifications@github.com wrote:

Service installed and paused? Or doesn't start when you start it? For start after instal '-a' flag needed.

— Reply to this email directly or view it on GitHub https://github.com/jfromaniello/winser/issues/28#issuecomment-52384525.

PSyton commented 10 years ago

This is work from console? without service?

PSyton commented 10 years ago

Path to node exists in PATH for user from wich service starts?

johnsoftek commented 10 years ago

"npm start" works from the console and, yes, node and npm are in the path (as shown by npm start just works)

If I use "nssm edit myservice" and change the command from "c:...\npm.cmd" to "node" and parameters from "start" to "server.js", the service starts and works perfectly.

I spent hours trying to get winser -i to work. Sorry, I can't give more feedback.

On 16 August 2014 17:22, Pavel V. Sysolyatin notifications@github.com wrote:

Path to node exists in PATH for user from wich service starts?

— Reply to this email directly or view it on GitHub https://github.com/jfromaniello/winser/issues/28#issuecomment-52386312.

PSyton commented 10 years ago

try "install-windows-service": "winser -i --nonpm --startcmd=\"node server.js\"". This write "node" and parameters "server.js" for nssm. It think winser need ignore npm when startcmd is provided.

johnsoftek commented 10 years ago

As I said in my first post, starting node directly does work, and you don't need --nonnpm:

 "install-windows-service": "winser -i --startcmd=\"node server.js\"",
PSyton commented 10 years ago

Default command changed to "node .."

Surreal9 commented 10 years ago

Just ran into a similar problem at my office. We noticed a reference in npm-debug.log to a missing directory, and ended up working around it by creating the directory C:\Windows\System32\config\systemprofile\AppData\Roaming\npm

This allowed the service to start.

sixlettervariables commented 10 years ago

@Surreal9, that certainly fixed it for me. That definitely needs to be up on the README.