node-red icon indicating copy to clipboard operation
node-red copied to clipboard

Project Clone From GitHub not working when node-red started as service

Open FlameMetalsGitHub opened this issue 6 months ago • 1 comments

Current Behavior

On both versions 4.0.2 and 4.0.9 and the newest version of RaspberryPi OS dated 2025-05-13. This is a clean install of both. I get an error when I try to clone a project from GitHub. There is not a directory "/run/user/0".

Image

An unexpected error occurred: listen EACCES: permission denied /run/user/0/node-red-git-askpass-b17c333040d9423f-sock code: EACCES

Image

Image

Image

Expected Behavior

No response

Steps To Reproduce

Start Imager Select Raspberry Pi 4 Select Raspberry Pi OS (64 Bit) dated 2025-05-13 Install to storge device

Move SD card to Raspberry Pi 4 Set up network address

After Install sudo apt update sudo apt full-upgrade sudo reboot

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) --allow-low-ports --node20 --confirm-pi --update-nodes --nodered-version="4.0.9"

sudo systemctl enable nodered.service

Example flow

None

Environment

  • Node-RED version:4.0.2 or 4.0.9
  • Node.js version: 20.19.2
  • npm version:10.8.2
  • Platform/OS: Raspberry Pi 4 / Raspberry Pi OS (64 Bit) dated 2025-05-13
  • Browser: Windows 11 / Google Chrome Version 136.0.7103.114 (Official Build) (64-bit)

FlameMetalsGitHub avatar May 20 '25 16:05 FlameMetalsGitHub

I would propose to set the user with the following option found on the installation script according to your system. --nodered-user specify the user to run as, useful for installing as sudo - e.g. --nodered-user=pi

xelinorg avatar May 20 '25 19:05 xelinorg

@FlameMetalsGitHub did you manage to solve this issue? I am running into the same problem.

durable-developer avatar Jul 24 '25 18:07 durable-developer

Seeing the same problem running Node-RED 4.1.1 on a Pi 4, set up in the same way as described here (using the bash script)

papakpmartin avatar Nov 12 '25 17:11 papakpmartin

Can somebody try the following (assuming running as pi and that uid for that user is 1000)

Create a file in ~pi/node-red called environment and add the following:

XDG_RUNTIME_DIR=/run/user/1000

Then restart the service and test again

hardillb avatar Nov 12 '25 17:11 hardillb

Verified working! The file needs to be at ~/.node-red/environment (which is /home/pi/.node-red/environment) and needs to contain XDG_RUNTIME_DIR=/run/user/1000 (not sure if a following line break is required, but I added one just in case).

papakpmartin avatar Nov 12 '25 18:11 papakpmartin

I wonder if this means that choosing Projects during the running of the installation bash script should result in ~/.node-red/environment being created, having XDG_RUNTIME_DIR=/run/user/1000 in it?

papakpmartin avatar Nov 12 '25 20:11 papakpmartin

Having the install script do that is probably not a bad idea /cc @dceejay

Probably needs to be a bit smarter than just 1000 (e.g. should us uid to get the correct value for the user)

hardillb avatar Nov 13 '25 09:11 hardillb

added to latest install script - hopefully it helps...

dceejay avatar Nov 22 '25 17:11 dceejay