Settings.js "Error writing settings.js:Permission denied"

Can you please deinstall node-red, and reinstall following the instructions in the Node-RED docs?
https://nodered.org/docs/getting-started/local

Or for Ubuntu you can use the bash installation script provided for the Pi. https://nodered.org/docs/getting-started/raspberrypi

THIS IS (or was) A SNAP INSTALL so is NOT a standard install
see

1 Like

Thanks for the link Dave, I'm not familiar at all with snap, thought it just meant a different install path. Learning new things every day :slight_smile:

Based on that, ignore my previous instructions @pcborges
The following quote is from the README of the repository Dave linked.

The settings.js and flows.json file are located in the /root/snap/node-red/current/ directory.

So to add in the adminAuth support, try editing the settings.js file in the above path.

Having said that. The full install is the preferred / most flexible way to install. But the snap should work and we are happy to take improvements if there are any experts out there...

1 Like

Now I can post replies again....:slightly_smiling_face:

Thanks afelix but the reinstall you suggested above worked ok.
Node-red is up and running including authentication!
Thanks
Paulo

1 Like

People, I thought I was ok but then not that much...

Everything is working good but then I tried to execute:
sudo systemctl enable nodered.service

And got:
Failed to enable unit: Unit file nodered.service does not exist.

But then:
node-red starts node-red sucessfuly.

How did you install node-red this time?

Uninstalled and then:
https://nodered.org/docs/getting-started/local (sudo npm install -g --unsafe-perm node-red)

Again, everything works ok, including authentication.
Also it sends data to influxDB flawlessly.

If you had used the Pi script I linked to it would have installed the systemd service scripts. If you follow the link at th bottom of that page, Starting node-RED on boot, (which suggests again using the Pi script) then down the bottom is a link to the systemd script as used by the Pi install.

So, just to make sure I am in the right track:

sudo npm install -g pm2
which node-red returns: /usr/bin/node-red
pm2 start /usr/bin/node-red -- -v
check with:
pm2 info node-red
pm2 logs node-red

What do you think?

Just run the sequence...
after reboot I run pm2 info node-red and it returns:
node-red doesn't exist...

No, you are on Ubuntu, use the systemd script I linked to (or use the pi install script). At least that is the usual way.

1 Like

Colin, there are so many alternatives...

Do you mean to use the script:

bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)

and then:
sudo systemctl enable nodered.service

Do I have to uninstall?

Because node-red is workin perfect, I just need it to auto start at boot

If you just want to add the systemd script for running it as a service then you can do that (I described where to find it) and all should be well. Since you have everything else going as you want that is possibly the best plan.
Alternatively you could use the bash <(curl script which will install it all in one go for you and also give you the commands node-red-start, node-red-stop and node-red-log. You would not need to uninstall the existing node-red. However, as I said, since it is all working then possibly best just to get the systemd script.
You should check which version of nodejs you have, if you haven't already done that. It should be 8.x or 10.x You can check that by running
node -v
That is another advantage of the Pi script, it would install a valid version of node.