Running node red as a service_Error

Hi,
I need to run node red as a service on windows .Followed all the instructions provided in the other posts pertaining to the same topic , but getting an error as below:

And yes ,was trying to install nssm from 64 bit package since my system has a configuration of windows 10 , 64 bit.

Please help!.

BTW..any alternative to nssm or a way to run node red without the command prompt window open ?

Double check the path of the startup js file. I can see a double-backslash in there - not sure if that indicates something might be wrong with it.

As for starting without the extra command window. You can use the Windows Task Scheduler to start Node-RED before a user login. To do that, you either have to run it as SYSTEM or provide a user id and password. If you need more control, you could try using PM2 as well.

Overall though, running as a service is generally the best idea if you need Node-RED to run continuously.

dont run nssm from desktop as it will be forever more locked by the service (it actually runs from the desktop)

At a guess, you downloaded nssm - maybe it is blocked by windows?
image

Now assuming you are running this as a service with the service account (default) then the service account will NOT have access to c:\users\rejoekoshy\xxx

So move nssm to a neutral location (e.g. something like c:\node-red\)

Additionally, i assume user rejoekoshy is your setup account and will NOT normally be logged in? The default npm global location is global only to the user (not the system) - so i would recommend a non global install of node-red to somewhere the system account has access (e.g. c:\node-red) and then NSSM and node-red are in the same directory.

Hi,
Could not install nssm due to repeated errors and hence had to resort to another scheme .I wrote a batch script to run node red (with the command window hidden) and hooked it with the start up process of the system.

.bat file script --- "ECHO ON
ECHO Starting Node Red...
node-red "
.vbs file script (to run with command window hidden) --"Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "D:\OneDrive - Tega Industries Ltd\Desktop\RUN_NODERED\nodered.bat" & Chr(34), 0
Set WshShell = Nothing "

I am also looking to stop node red with a batch file command. Can anyone help me with the script?

On Windows it is a real pain to identify the node process, especially if you have more than one. You could do something like this in powershell:

netstat -ano | Select-String "LISTENING" | Select-String "1880" | ForEach-Object {$_.Line.split()[-1]} | ForEach-Object { Get-Process -Id $_} | Stop-Process

This will find the process that is listening on port 1880 (default NR port) and stop it.

Not really, Node.js has a library for it. simply add process.pid to a global variable in settings.js

1 Like

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