Node Red update and add-ons fail @ DietPi @ Raspberry Pi Zero W

looks better running installation of node-red-node-pi-gpio on CLI now

root@DietPi1:~# cd /mnt/dietpi_userdata/node-red
root@DietPi1:/mnt/dietpi_userdata/node-red# sudo -u nodered npm i node-red-node-pi-gpio

added 1 package, and audited 364 packages in 43s

7 packages are looking for funding
  run `npm fund` for details

4 moderate severity vulnerabilities

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
npm notice
npm notice New minor version of npm available! 7.11.2 -> 7.12.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v7.12.0
npm notice Run npm install -g npm@7.12.0 to update!
npm notice
root@DietPi1:/mnt/dietpi_userdata/node-red#

will do a test via web ui as well

installation via web ui seems to be working as well. No error message on screen. Below the output from journalctl

May 07 10:55:17 DietPi1 node-red[2497]: ---------------------------------------------------------------------
May 07 10:55:17 DietPi1 node-red[2497]: 7 May 10:55:17 - [info] Server now running at http://127.0.0.1:1880/
May 07 10:55:17 DietPi1 node-red[2497]: 7 May 10:55:17 - [info] Starting flows
May 07 10:55:17 DietPi1 node-red[2497]: 7 May 10:55:17 - [info] Started flows
May 07 11:24:13 DietPi1 node-red[2497]: 7 May 11:24:13 - [info] Installing module: node-red-node-pi-gpio, version: 1.2.3
May 07 11:24:49 DietPi1 node-red[2497]: 7 May 11:24:49 - [info] Installed module: node-red-node-pi-gpio
May 07 11:24:49 DietPi1 node-red[2497]: /bin/sh: 1: /mnt/dietpi_userdata/node-red/node_modules/node-red-node-pi-gpio/testgpio.py: not found
May 07 11:24:49 DietPi1 node-red[2497]: 7 May 11:24:49 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
May 07 11:24:50 DietPi1 node-red[2497]: 7 May 11:24:50 - [info] Added node types:
May 07 11:24:50 DietPi1 node-red[2497]: 7 May 11:24:50 - [info]  - node-red-node-pi-gpio:rpi-gpio in
May 07 11:24:50 DietPi1 node-red[2497]: 7 May 11:24:50 - [info]  - node-red-node-pi-gpio:rpi-gpio out
May 07 11:24:50 DietPi1 node-red[2497]: 7 May 11:24:50 - [info]  - node-red-node-pi-gpio:rpi-mouse
May 07 11:24:50 DietPi1 node-red[2497]: 7 May 11:24:50 - [info]  - node-red-node-pi-gpio:rpi-keyboard

Great, many thanks for testing!

Hi,
sadly I do have same issue on RPi2 with dietpi 7.1.2
fresh install of node-red is working fine - but without RPI gpio flow
any module install from palette menu causes node-red to crash and won’t able to restart anymore.

tried several thing, as sudo, root, regular user, whatever.
nothing worked :frowning:

Hi,

a fix will be provided with DietPi v7.2

in menatime you can do following. I assume Node-Red is not yet installed :slight_smile:

  1. dietpi-software install 122
  2. cd /mnt/dietpi_userdata/node-red
  3. sudo -u nodered npm i node-red-node-pi-gpio
  4. dietpi-software reinstall 122

so … shall i reinstall node-red everytime new module is installed? cos it looks like every install does that (on my machine so far)

or maybe i’ll try to install all modules I need and then reinstall it once for all … dunno
it takes ages to reinstall it on rpi2 tho

well not sure if this is applicable for all installations but node-red-node-pi-gpio will remove nearly all other modules and Node-Red is not functioning anymore afterwards. That’s why it is needed to perform reinstall at the moment. An option would be to switch to the develpment branch where the developer provided a possible fix. https://github.com/MichaIng/DietPi/pull/4345

seems like it’s only needed reinstall for node-red-node-pi-gpio but gpio is seen as not available in nodered
everything looks ok-ish, but looks like node-red can’t handle gpio

ok needed to apt install RPi.GPIO … seems like dietpi-software instalation of python3 rpi-gpio is not enough

Since the APT package “RPi.GPIO” does not exist, which one was finally installed (probably it’s an alias)? “python-rpi.gpio”, hence the Python 2 version?

Or did you mean pip install RPi.GPIO?

EDIT: Okay known issue: https://github.com/node-red/node-red-nodes/issues/721
The module actually works with Python 3, but it looks for the “python” command, which is Python 2 (officially EOL since this January). You installed now the Python 2 stack, which works, but we don’t want to ship a deprecated Python version that does not receive security updates anymore on a regular basis.

One solution to keep using Python 3 is to create a symlink or alternative (now not possible with Python 2 installed):

update-alternatives --install /usr/bin/python python2to3 /usr/bin/python3 1

This creates an alternative for the “python” command to be finally provided by the “python3” command, gives it the name “python2to3” (as alternatives system reference) with priority 1 (lowest), so that it is overridden by anything else providing this command. Finally a symlink will be created:

/usr/bin/python => /etc/alternatives/python2to3 => /use/bin/python3

It is a little less intrusive than a direct symlink and can be overwritten automatically by APT packages, e.g. when you install Python 2 for a different reason.

python-rpi.gpio-dbgsym/testing,now 0.7.0-0.1~bpo10+4 armhf [installed]
python-rpi.gpio/testing,now 0.7.0-0.1~bpo10+4 armhf [installed]
python3-rpi.gpio-dbgsym/testing,now 0.7.0-0.1~bpo10+4 armhf [installed]
python3-rpi.gpio/testing,now 0.7.0-0.1~bpo10+4 armhf [installed]
rpi.gpio-common/testing,now 0.7.0-0.1~bpo10+4 armhf [installed]

i think i did not pip install anything from cmndline, instead of rpi.gpio

anyway, with default dietpi-softwared nodered+python3.rpigpio it was not working, after reinstall of nodered I was able to start nodered by rpi gpio OUT was not available and after I’ve installed rpi.gpio from apt (probably common?) and restarted node-red, it was working.