Install ~/.node-red without running node-red

I have an AWS instance that is created via ansible provisioning, I am at a point where I need to have the .node-red folder in my default ubuntu user account. When I install node-red (using root) sudo npm install -g --unsafe-perm node-red node-red-admin and run it using pm2, I get a root user instance of node-red running in the background. I don't want to have node-red running as root for security reasons, so I want to init my ubuntu user to have the .node-red folder,
but when I install node-red it only creates it for the root user.

Should I be installing node-red without sudo to be able for ubuntu user to have the .node-red folder in /home/ubuntu/.node-red ?

I notice once I am in ubuntu account I can run node-red and this sets up the folders for me on for that user's home folder.

A problem I have is when I try to run node-red via ubuntu user, it hangs on the ansible-playbook running part, as I think it thinks the node-red process hasn't exited yet, and waits.

I was wondering if there is a way to create this init of node-red in ubuntu home folder without running node-red?

It doesn't matter how you install node-red, it matters how you run it.

Node-RED will create the .node-red directory in the home directory of the user running it - and that only happens when you run, not when you install.

There's nothing stopping you manually creating the directory yourself.

Another option is to use our Pi install script which works on Ubuntu - https://nodered.org/docs/getting-started/raspberrypi and will set it up to run as a service, rather than rely on pm2.

I note you are installing node-red-admin - in case you missed it, you don't need to install that separately anymore as it is built into the main node-red command. See the 1.1.0 release blog post for details.

1 Like

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