Run as Windows Service

I'm a windows guy. I have installed a new Windows 2022 Server, joined our windows domain, installed node.js 14.20.1 and npm 6.14.17

i moved npm to %AllUsersProfile%

i installed node-red with "npm install node-red"

i created a service with nssm, it command line 'node-red.cmd --settings C:\ProgramData\npm\node-red.js --userDir C:\ProgramData\npm --verbose

if i user the domain administrator for this service i could install everything but i wan't to run node-red with lower rights

if i use the local admin i can't install any palette (example: node-red-contrib-influxdb), this damaged my whole node-red installation :frowning:

which right do a windows user needs to do this?

A Windows question rather than specifically Node-RED.

node-red.cmd --settings C:\ProgramData\npm\node-red.js --userDir C:\ProgramData\npm --verbose

That command is wrong in several ways. You really need to understand more about how node.js works.

You have tried to use the master javascript file as the settings file (which is what destroyed your node-red install) and you have put the userDir in a location that only an admin and SYSTEM can access.

You don't need to specify settings as Node-RED will work that out, you can simply specify the userDir folder which should be in the selected users home folder somewhere. By default if you simply run node-red.cmd under a user id, it will put the userDir into c:\users\<userid>\.node-red. Just as if you ran it manually under your own logged in user.

Additionally to TotallyInformations answer eventually it has to do with user rights of your service. You may use the login data of your local admin?


I renamed the settings.js to node-red.js. Everything works with the Domain Admin account. I followed the documentation to share node-red between users.

But if i use a user of group users (local) it won't work. Sure, there are permissions missing. But wich permissions? (Running as Service is set)

Not really a brilliant idea I'm afraid. You should run node-red as a standard user if at all possible (and it should always be possible) to avoid issues like those seen in another recent thread on hacked servers.

If you leave it like that, you can expect your entire domain to be compromised pretty quickly.

I already pointed that out. It is because you put some files in the wrong place.

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