# \[Solved\] Running as a service on windows

**URL:** <https://discourse.nodered.org/t/solved-running-as-a-service-on-windows/22683>\
**Category:** General\
**Created:** [6 March 2020 02:51 UTC](https://discourse.nodered.org/t/solved-running-as-a-service-on-windows/22683 "2020-03-06T02:51:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dathor](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@dathor](https://discourse.nodered.org/u/dathor)\
**Post date:** [6 March 2020 02:51 UTC](https://discourse.nodered.org/t/solved-running-as-a-service-on-windows/22683/1 "2020-03-06T02:51:11Z")

</div>

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/](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

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [6 March 2020 05:23 UTC](https://discourse.nodered.org/t/solved-running-as-a-service-on-windows/22683/2 "2020-03-06T05:23:21Z")

</div>

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](https://nssm.cc/) 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](https://discourse.nodered.org/search?q=nssm)

---

<div class="post-metadata">

**Author:** ![dathor](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@dathor](https://discourse.nodered.org/u/dathor)\
**Post date:** [6 March 2020 05:25 UTC](https://discourse.nodered.org/t/solved-running-as-a-service-on-windows/22683/3 "2020-03-06T05:25:12Z")

</div>

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

[https://gist.github.com/dceejay/576b4847f0a17dc066db](https://gist.github.com/dceejay/576b4847f0a17dc066db)

````auto
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"```
````

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [6 March 2020 05:25 UTC](https://discourse.nodered.org/t/solved-running-as-a-service-on-windows/22683/4 "2020-03-06T05:25:24Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![dathor](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@dathor](https://discourse.nodered.org/u/dathor)\
**Post date:** [6 March 2020 05:29 UTC](https://discourse.nodered.org/t/solved-running-as-a-service-on-windows/22683/5 "2020-03-06T05:29:20Z")

</div>

Thanks, yes using nssm worked as expected.

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [6 March 2020 05:30 UTC](https://discourse.nodered.org/t/solved-running-as-a-service-on-windows/22683/6 "2020-03-06T05:30:50Z")

</div>

Good. 🙂

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [20 March 2020 05:30 UTC](https://discourse.nodered.org/t/solved-running-as-a-service-on-windows/22683/7 "2020-03-20T05:30:51Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
