[Solved] Running as a service on windows

Hello

I would like to ask for some help regarding running my node-red project as a service on a windows machine.

To date i have followed the instructions that were provided (on the faq) in the below link. There were a few options to choose from , this is the one I tried first.
https://www.hardill.me.uk/wordpress/2014/05/30/running-node-red-as-a-windows-or-osx-service/

now, i have followed these instructions and used the following path when installing the service.

script: require('path').join('C:','Users','myUserName','AppData','Roaming','npm','node_modules','node-red','red.js')

I restart my computer and the in the browser navigate to localhost:1880 , sure enough node-red is running but it is not running the project that i have developed in my user .node-red directory. instead it is a blank project.

What am i missing here? How do i point the service to launch the project in my user .node-red directory.

Thanks

First, that post is 6 years old, so there are alternatives to node-windows.

I have never used node-windows, but I suspect the service gets started as a different user, meaning a different workspace is used.

I can recommend using NSSM on windows. Been using it for ages in these setups.
If you search the forum for NSSM, you will find many hits.

https://discourse.nodered.org/search?q=nssm

I also tried using the following method which worked as provided by @dceejay

https://gist.github.com/dceejay/576b4847f0a17dc066db

nssm install Node-RED "c:\Users\\"%USERNAME%"\AppData\Roaming\npm\node-red.cmd"
nssm set Node-RED AppDirectory "c:\Users\\"%USERNAME%"\.node-red"
nssm set Node-RED AppParameters "-u c:\Users\\"%USERNAME%"\.node-red > c:\temp\node-red.log"
nssm set Node-RED Description "A wiring tool for the Internet of Things"```

You can specify the workspace using the -u command line parameter.

I see you posted at the same time and already tried NSSM. Is it working?

Thanks, yes using nssm worked as expected.

Good. :slightly_smiling_face:

BTW: You can mark one post as solution, so we can close this thread earlier.