Making a node.js service using NSSM

utkarsh tyagi picture utkarsh tyagi · Jan 7, 2017 · Viewed 12.2k times · Source

I want to create a nodejs service, so that the node server starts as my computer starts, and i do not have to keep the command prompt open all the time. I m tryng to achieve this by using NSSM.

Here is the command to create the service:

nssm.exe install jewel-server C:\Program Files\nodejs\node.exe D:\jewel\server.js

Run service:

net start jewel-server

But this doesnt work and give this error:

The jewel-server service is starting.
The jewel-server service could not be started.

A service specific error occured: 3.

I checked error code 3 means the path is not correct but the is path correct. Can you tell what i am doing wrong, or is there any other open source & more reliable alternative to NSSM

Version:

NSSM
version: 2.24
Windows-7 64bit

Answer

utkarsh tyagi picture utkarsh tyagi · Jan 7, 2017

The way parameters were passed was not correct, So used the NSSM GUI to set the parametes:

Open GUI: nssm.exe install jewel-server

Once the GUI is open give in the following values.

Path: C:\Program Files\nodejs\node.exe
Arguments: D:\jewel\server.js
Press Install service

Done! You can start the service now.