How to Autostart NodeRed in Windows?

Hey there,
I am running Node-Red under Windows Server 2016.

Right now there is a BAT-File that I have to restart manually after a Server-Reboot to restart Node-Red.

The command looks like that: node-red -p 19999 -u c:\NR19999

But if I double-click the batch file this is what happens:

image

If I copy the command to a manually opened command line windows and start it, it works fine and Node-Red start to run.

I would really like to have Node-Red automatically up and running ... what do I have to do ? :slight_smile:

BR
G

Hi @Gawan

A quick search on the forum reveals this has been covered many times.

See this thread as an example; Run on windows as service - #2 by Steve-Mcl

It has links to docs and examples.

I tried this approach, but unfortunately the service always goes to "Paused" state

Then you are likely doing something wrong.

For example, how is node-red installed? I will assume using npm -g ... (which means install to the "global" path. On windows, that global path is (by default) located in the current users profile. Which means only accessable to the user. Keep that in mind while I explain the next bit...

By default, nssm uses the system account. So any attempt to run node-red will likely fail since your files and your node-red project don't exist in the system account.

You have multiple options here.

  • You could set up NSSM to run under the account that installed node-red.
  • you could set up an account purely for node-red, install Node-RED under that account, set NSSM to use the new account.
  • you could move the default "global" location and where the .node-red user directory exists so that the system account can access the installation and .node-red project files.

This is not something specific to Node-RED. This is basic windows services, accounts and npm peculiarities that you need to work through.

Hopefully there are enough clues for you to make progress.

1 Like

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