Node-red-pi not found?

Please, can any1 help me with these errors in /var/logs/syslog
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
/usr/bin/env: ‘node-red-pi’: No such file or directory
nodered.service: Main process exited, code=exited, status=127/n/a
nodered.service: Failed with result 'exit-code'.
nodered.service: Scheduled restart job, restart counter is at 36.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
/usr/bin/env: ‘node-red-pi’: No such file or directory
nodered.service: Main process exited, code=exited, status=127/n/a
nodered.service: Failed with result 'exit-code'.
nodered.service: Scheduled restart job, restart counter is at 37.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
/usr/bin/env: ‘node-red-pi’: No such file or directory
nodered.service: Main process exited, code=exited, status=127/n/a
nodered.service: Failed with result 'exit-code'.
nodered.service: Scheduled restart job, restart counter is at 38.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
/usr/bin/env: ‘node-red-pi’: No such file or directory
nodered.service: Main process exited, code=exited, status=127/n/a
nodered.service: Failed with result 'exit-code'.

I have no clue as where to look for the missing config or what :frowning:

How did you install node red and how are you running it.

I guess you are on a Raspberry Pi?

It's probably a good idea to [re]run the installation script:

cd
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) --node18

Assuming it installs OK, Node-red should run automatically when you reboot, but for the first test, run node-red-start. You will see warnings but hopefully no errors.
When you have checked that it's running, CTRL C will stop it.

I am not certain but I think it defaults to not running automatically. To run node-red automatically on boot then run
sudo systemctl enable nodered
and the next time it boots node red will start. Use disable to stop it running automatically.

A small clarification there. CTRL C will stop the log appearing in the terminal but will not stop node red, as node-red-start starts it as a service. To stop node-red when running as a service use node-red-stop.

Thanks for the clarification about node-red-start & node-red-stop Colin. I never use those commands myself, I always use sudo systemctl stop nodered & sudo systemctl restart nodered but if you tell people that there's a 50% chance they assume you accidentally omitted a hyphen! That's why I mentioned rebooting.

The installation script has definitely always enabled Node-red for me on Raspberry Pi, though it's been a while since I installed it and didn't see a warning about non-standard systemd script. Maybe it will not enable it in those circumstances.
I must get round to investigating that.

Once you have enabled it, running the script will not disable it. The question is whether the first install enables it or not. I may well be wrong though.

OK I just disabled it, ran the install script and no it's not automatically enabled. Sorry for the misinformation.

Actually I'm on Odroid HC4.. but since there were not explicit guides as how to install node red on this, i used rpi guide..
nodered is working fine on it, however i just discovered it is feeding this error into syslog and I'd like to mend it.

Do you mean you ran the bash <(curl command?

Right..
I think I used this guide:
https://nodered.org/docs/getting-started/raspberrypi

I tried to run this command manually and it works ok node-red-pi..
So what I actually need to find, what is trying to run this program...

Aug 13 00:01:33 odroid Node-RED[1737695]: /usr/bin/env: <80><98>node-red-pi<80><99>: No such file or directory

What does
sudo systemctl status nodered
show?
If it refers to a service file, possibly it will show
Loaded: loaded (/lib/systemd/system/nodered.service; enabled; vendor preset: enabled)
then what is in that file?

odroid@odroid:~$ sudo systemctl status nodered
[sudo] password for odroid:
● nodered.service - Node-RED graphical event wiring tool
Loaded: loaded (/lib/systemd/system/nodered.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Mon 2023-08-14 09:59:30 CEST; 17s ago
Docs: Redirecting…
Process: 33984 ExecStart=/usr/bin/env node-red-pi $NODE_OPTIONS $NODE_RED_OPTIONS (code=exited, status=127)
Main PID: 33984 (code=exited, status=127)

Halleluja.. it is here:

odroid@odroid:~$ more /lib/systemd/system/nodered.service

systemd service file to start Node-RED

[Unit]
Description=Node-RED graphical event wiring tool
Wants=network.target
Documentation=Redirecting…

[Service]
Type=simple

Run as normal pi user - change to the user name you wish to run Node-RED as

User=odroid
Group=odroid
WorkingDirectory=/home/odroid

Environment="NODE_OPTIONS=--max_old_space_size=1024"

define an optional environment file in Node-RED's user directory to set custom variables externally

EnvironmentFile=-/home/odroid/.node-red/EnvironmentFile

uncomment and edit next line if you need an http proxy

#Environment="HTTP_PROXY=my.httpproxy.server.address"

uncomment the next line for a more verbose log output

#Environment="NODE_RED_OPTIONS=-v"

uncomment next line if you need to wait for time sync before starting

#ExecStartPre=/bin/bash -c '/bin/journalctl -b -u systemd-timesyncd | /bin/grep -q "systemd-timesyncd.* Synchronized to time server"'

ExecStart=/usr/bin/env node-red-pi $NODE_OPTIONS $NODE_RED_OPTIONS
#ExecStart=/usr/bin/env node $NODE_OPTIONS red.js $NODE_RED_OPTIONS

Use SIGINT to stop

KillSignal=SIGINT

Auto restart on crash

Restart=on-failure
RestartSec=20

Tag things in the log

SyslogIdentifier=Node-RED
#StandardOutput=syslog

[Install]
WantedBy=multi-user.target
odroid@odroid:~$

But I think, this actually causes my node red to start and work OK..

One more thing I noticed in syslog the lines looks like this:


Aug 13 00:01:54 odroid Node-RED[1737704]: /usr/bin/env: <E2><80><98>node-red-pi<E2><80><99>: No such file or directory

See the <80> <98>
(this editor actually doesn't want to show < E 2 > if I type it together..
This looks like some kind of quation mark or something I copied from the web.. and this causes probably something to not be able to execute node-red-pi

How are you running node red? The command to run it as a service is
node-red-start

Does this command run?
/usr/bin/env
It should show the current environment.

If you edit your previous post with the service file and add triple backticks before and after the file then it will stop the forum from interpreting the file as markdown and messing with the formatting.

Yes, I run it as a service (after odroid restarts, nodered starts automatically).

This is the result of /usr/bin/env

odroid@odroid:~$ /usr/bin/env
SHELL=/bin/bash
GTK_MODULES=appmenu-gtk-module
PWD=/home/odroid
LOGNAME=odroid
XDG_SESSION_TYPE=tty
MOTD_SHOWN=pam
HOME=/home/odroid
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
SSH_CONNECTION=192.168.0.183 53958 192.168.0.181 22
LESSCLOSE=/usr/bin/lesspipe %s %s
XDG_SESSION_CLASS=user
TERM=xterm
LESSOPEN=| /usr/bin/lesspipe %s
USER=odroid
SHLVL=1
UBUNTU_MENUPROXY=1
XDG_SESSION_ID=22
XDG_RUNTIME_DIR=/run/user/1000
SSH_CLIENT=192.168.0.183 53958 22
XDG_DATA_DIRS=/home/odroid/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop
PATH=/usr/local/lib/nodejs/node-v18.16.0-linux-arm64/bin:/usr/local/lib/nodejs/node-v18.16.0-linux-arm64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
SSH_TTY=/dev/pts/0
_=/usr/bin/env
odroid@odroid:~$

What do you see if you run
node-red-stop
node-red-start
Which should stop node red then start it again as a service.

odroid@odroid:~$ node-red-stop
Stop Node-RED

Use   node-red-start   to start Node-RED again
[sudo] password for odroid:

odroid@odroid:~$

and then start:

odroid@odroid:~$ node-red-start

Start Node-RED

Once Node-RED has started, point a browser at http://192.168.0.181:1880
On Pi Node-RED works better with the Firefox or Chrome browser

Use   node-red-stop                          to stop Node-RED
Use   node-red-start                         to start Node-RED again
Use   node-red-log                           to view the recent log output
Use   sudo systemctl enable nodered.service  to autostart Node-RED at every boot
Use   sudo systemctl disable nodered.service to disable autostart on boot

To find more nodes and example flows - go to http://flows.nodered.org

Starting as a systemd service.
nodered.service: Scheduled restart job, restart counter is at 3034.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
/usr/bin/env: ‘node-red-pi’: No such file or directory
nodered.service: Main process exited, code=exited, status=127/n/a
nodered.service: Failed with result 'exit-code'.

So node red won't run as a service, I can only guess that the env when running as a service does not have /usr/bin in the path. You could edit the service file and change node-red-pi to /usr/bin/node-red-pi

Have you done something to cause that, other than using the normal service file?