MichaIng / DietPi

Lightweight justice for your single-board computer!
https://dietpi.com/
GNU General Public License v2.0
4.9k stars 499 forks source link

DietPi-Software: installation of Node-RED (122) fails #7252

Open mvanbrab opened 1 month ago

mvanbrab commented 1 month ago

Creating a bug report/issue

Required Information

Additional Information (if applicable)

Steps to reproduce

  1. as root user, start dietpi-software
  2. search for software "Node-RED" (122) and select it for installation.
  3. install

Expected behaviour

Actual behaviour

Extra details

MichaIng commented 1 month ago

Hmm the error indicates a network issue, but a connection check is fine before the install. Maybe npmjs servers have an issue 🤔. I'lly to replicate.

mvanbrab commented 2 weeks ago

Hi @MichaIng ,

I tried one more time from a fresh image today and I could at least finalize the installation of Node-RED this time, so there may have been some intermittent connectivity issue during all my previous trials, or some changes may have happened in the online resources meanwhile.

However, the installation result was not as expected: the service fails to start.

I tried to diagnose:

root@dietpi1:~# systemctl status node-red
× node-red.service - Node-RED (DietPi)
     Loaded: loaded (/etc/systemd/system/node-red.service; enabled; preset: enabled)
     Active: failed (Result: signal) since Wed 2024-11-06 18:00:44 CET; 2min 34s ago
   Duration: 5.203s
    Process: 3629 ExecStart=/mnt/dietpi_userdata/node-red/node_modules/.bin/node-red -u /mnt/dietpi_userdata/node-red (code=killed, signal=ILL)
   Main PID: 3629 (code=killed, signal=ILL)
        CPU: 4.466s

Nov 06 18:00:39 dietpi1 systemd[1]: Started node-red.service - Node-RED (DietPi).
Nov 06 18:00:44 dietpi1 systemd[1]: node-red.service: Main process exited, code=killed, status=4/ILL
Nov 06 18:00:44 dietpi1 systemd[1]: node-red.service: Failed with result 'signal'.
Nov 06 18:00:44 dietpi1 systemd[1]: node-red.service: Consumed 4.466s CPU time.
root@dietpi1:~#

I tried to further investigate by executing the ExecStart command found in /etc/systemd/system/node-red.service. It resulted in a single line error message:

root@dietpi1:~#/mnt/dietpi_userdata/node-red/node_modules/.bin/node-red -u /mnt/dietpi_userdata/node-red
Illegal instruction

For what it's worth, I found a post on the Node-RED forum, describing exactly the same behaviour, also on a RPi Zero W, but outside DietPi.

Maybe that solution needs to be integrated in DietPi?

MichaIng commented 2 weeks ago

Our Node.js installer https://github.com/MichaIng/nodejs-linux-installer installs the unofficial Node.js builds on ARMv6 already. Problem is the bcrypt module, it seems.

I'll run some tests on my Zero W.

MichaIng commented 2 weeks ago

Node-RED v4 adds a new dependency @node-rs/bcrypt, which does not support ARMv6:

We hence need to install Node-RED v3 on ARMv6: https://github.com/MichaIng/DietPi/commit/2187d65

To do that manually:

systemctl stop node-red
cd /mnt/dietpi_userdata/node-red
sudo -u nodered npm i --no-audit node-red@3
systemctl start node-red
mvanbrab commented 2 weeks ago

The manual workaround works perfectly on my RPi Zero W! Thank you very much @MichaIng !