Raspberry pi: node red not installable any more with script from nodered.org

Hello,

I am trying since yesterday to install node red on a fresh raspbian.
a) with the latest image with bullseye (the lite one!) it seems to be impossible to install with the script from Running on Raspberry Pi : Node-RED

it quits with "curl: (23) Failure writing output to destination" and afterwards "Bad install: Node.js v12.22.12 Npm missing - Exit"

so I tried now with buster (which should be supported?) lite image: 2022-09-22-raspios-buster-armhf-lite.img.xz

the error message there: "curl: (23) Failed writing body (0 != 7067)" and afterwards "Bad install: Node.js v10.24.0 Npm missing - Exit"

I tried to select --node14 and --node16 (ob bullseye and buster) but both did not help.

before, I did ofc the upgrade to the latest packages with apt, on buster and also on bullseye.

it is not a broken SD-card, it is not a full sd-card, it is not a insufficient power supply. it is not a broken internet connection, it is not a broken pi, it is not a broken network cable, ... driving me crazy :crazy_face:

the log from the last run on buster attached below. who can enlight me what I need to do?

Thank you! :slight_smile:

Started : Tue 13 Dec 12:30:56 CET 2022
Running for user root at /root
Failed to stop nodered.service: Unit nodered.service not loaded.
Found global nodes:   :

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
Package 'nodered' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Installing nodejs 16

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
Package 'nodejs-legacy' is not installed, so not removed
Package 'npm' is not installed, so not removed
The following packages were automatically installed and are no longer required:
  libbrotli1 libc-ares2 libnode64 libuv1 nodejs-doc
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  nodejs
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 154 kB disk space will be freed.
(Reading database ... ^M(Reading database ... 5%^M(Reading database ... 10%^M(Reading database ... 15%^M(Reading database ... 20%^M(Reading database ... 25%^M(Reading database ... 30%^M(Reading database ... 35%^M(Reading database ... 40%^M(Reading database ... 45%^M(Reading database ... 50%^M(Reading database ... 55%^M(Reading database ... 60%^M(Reading database ... 65%^M(Reading database ... 70%^M(Reading database ... 75%^M(Reading database ... 80%^M(Reading database ... 85%^M(Reading database ... 90%^M(Reading database ... 95%^M(Reading database ... 100%^M(Reading database ... 41588 files and directories currently installed.)^M
Removing nodejs (10.24.0~dfsg-1~deb10u2) ...^M
Processing triggers for man-db (2.8.5-2) ...^M
dpkg: warning: ignoring request to remove nodejs which isn't installed
dpkg: warning: ignoring request to remove node which isn't installed

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
  libbrotli1 libc-ares2 libnode64 libuv1 nodejs-doc
0 upgraded, 0 newly installed, 5 to remove and 0 not upgraded.
After this operation, 28.3 MB disk space will be freed.
(Reading database ... ^M(Reading database ... 5%^M(Reading database ... 10%^M(Reading database ... 15%^M(Reading database ... 20%^M(Reading database ... 25%^M(Reading database ... 30%^M(Reading database ... 35%^M(Reading database ... 40%^M(Reading database ... 45%^M(Reading database ... 50%^M(Reading database ... 55%^M(Reading database ... 60%^M(Reading database ... 65%^M(Reading database ... 70%^M(Reading database ... 75%^M(Reading database ... 80%^M(Reading database ... 85%^M(Reading database ... 90%^M(Reading database ... 95%^M(Reading database ... 100%^M(Reading database ... 41576 files and directories currently installed.)^M
Removing libnode64:armhf (10.24.0~dfsg-1~deb10u2) ...^M
Removing libbrotli1:armhf (1.0.7-2+deb10u1) ...^M
Removing libc-ares2:armhf (1.14.0-1+deb10u1) ...^M
Removing libuv1:armhf (1.24.1-1+deb10u1) ...^M
Removing nodejs-doc (10.24.0~dfsg-1~deb10u2) ...^M
Processing triggers for libc-bin (2.28-10+rpt2+rpi1+deb10u1) ...^M
Grab the LTS bundle

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
curl is already the newest version (7.64.0-4+deb10u3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
./update-nodejs-and-nodered: line 470: -E: command not found

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  libbrotli1 libc-ares2 libnode64 libuv1 nodejs-doc
Suggested packages:
  npm
The following NEW packages will be installed:
  libbrotli1 libc-ares2 libnode64 libuv1 nodejs nodejs-doc
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 6,360 kB of archives.
After this operation, 28.4 MB of additional disk space will be used.
Get:1 http://debian.anexia.at/raspbian/raspbian buster/main armhf libbrotli1 armhf 1.0.7-2+deb10u1 [257 kB]
Get:2 http://debian.anexia.at/raspbian/raspbian buster/main armhf libc-ares2 armhf 1.14.0-1+deb10u1 [80.9 kB]
Get:3 http://debian.anexia.at/raspbian/raspbian buster/main armhf libuv1 armhf 1.24.1-1+deb10u1 [96.9 kB]
Get:4 http://debian.anexia.at/raspbian/raspbian buster/main armhf libnode64 armhf 10.24.0~dfsg-1~deb10u2 [4,863 kB]
Get:5 http://debian.anexia.at/raspbian/raspbian buster/main armhf nodejs armhf 10.24.0~dfsg-1~deb10u2 [87.8 kB]
Get:6 http://debian.anexia.at/raspbian/raspbian buster/main armhf nodejs-doc all 10.24.0~dfsg-1~deb10u2 [975 kB]
Fetched 6,360 kB in 4s (1,814 kB/s)
Selecting previously unselected package libbrotli1:armhf.^M
(Reading database ... ^M(Reading database ... 5%^M(Reading database ... 10%^M(Reading database ... 15%^M(Reading database ... 20%^M(Reading database ... 25%^M(Reading database ... 30%^M(Reading database ... 35%^M(Reading database ... 40%^M(Reading database ... 45%^M(Reading database ... 50%^M(Reading database ... 55%^M(Reading database ... 60%^M(Reading database ... 65%^M(Reading database ... 70%^M(Reading database ... 75%^M(Reading database ... 80%^M(Reading database ... 85%^M(Reading database ... 90%^M(Reading database ... 95%^M(Reading database ... 100%^M(Reading database ... 41433 files and directories currently installed.)^M
Preparing to unpack .../0-libbrotli1_1.0.7-2+deb10u1_armhf.deb ...^M
Unpacking libbrotli1:armhf (1.0.7-2+deb10u1) ...^M
Selecting previously unselected package libc-ares2:armhf.^M
Preparing to unpack .../1-libc-ares2_1.14.0-1+deb10u1_armhf.deb ...^M
Unpacking libc-ares2:armhf (1.14.0-1+deb10u1) ...^M
Selecting previously unselected package libuv1:armhf.^M
Preparing to unpack .../2-libuv1_1.24.1-1+deb10u1_armhf.deb ...^M
Unpacking libuv1:armhf (1.24.1-1+deb10u1) ...^M
Selecting previously unselected package libnode64:armhf.^M
Preparing to unpack .../3-libnode64_10.24.0~dfsg-1~deb10u2_armhf.deb ...^M
Unpacking libnode64:armhf (10.24.0~dfsg-1~deb10u2) ...^M
Selecting previously unselected package nodejs.^M
Preparing to unpack .../4-nodejs_10.24.0~dfsg-1~deb10u2_armhf.deb ...^M
Unpacking nodejs (10.24.0~dfsg-1~deb10u2) ...^M
Selecting previously unselected package nodejs-doc.^M
Preparing to unpack .../5-nodejs-doc_10.24.0~dfsg-1~deb10u2_all.deb ...^M
Unpacking nodejs-doc (10.24.0~dfsg-1~deb10u2) ...^M
Setting up libbrotli1:armhf (1.0.7-2+deb10u1) ...^M
Setting up libc-ares2:armhf (1.14.0-1+deb10u1) ...^M
Setting up libuv1:armhf (1.24.1-1+deb10u1) ...^M
Setting up libnode64:armhf (10.24.0~dfsg-1~deb10u2) ...^M
Setting up nodejs-doc (10.24.0~dfsg-1~deb10u2) ...^M
Setting up nodejs (10.24.0~dfsg-1~deb10u2) ...^M
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode^M
Processing triggers for libc-bin (2.28-10+rpt2+rpi1+deb10u1) ...^M
Processing triggers for man-db (2.8.5-2) ...^M

Versions: node:v10.24.0 npm:missing

When you flashed the SD card, what user did you assign to the Pi?

Before you ran the script did you do a

sudo apt update
sudo apt full-upgrade

If not, then do that now. then when you run the install add --node16 to the end so you have:

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

Try that (after the update/full-upgrade) and see how that goes.

I presume that you downloaded the file and am running it manually. What is at (and around) that line?

There are several instances where the script itself calls curl to download further Node-red scripts.

If curl doesn't work to retrieve and run the script, downloading and running the script locally will still fail when it tries to call curl.

What does curl -V show you?

yes, as it did not work with the bash onliner I downloaded, made executeable and added "--node14"
so, I fired: "./update-nodejs-and-nodered --node14" or "./update-nodejs-and-nodered --node16"

@ zenofmud on the buster-image I added the user "pi" with the weak "raspberry" password on imaging. on the bullseye yesterday I had another user instead of pi.

I did not know I can add the "--node16" directly after the bash and curl command.
I just did this (after apt update and apt full-upgrade - there was nothing installed, already everything is up-to-date) and it failed again with the same lines:

  Remove old version of Node.js       #   v10.24.0
curl: (23) Failed writing body (0 != 7067)
  Install Node.js 16 LTS              #   Bad install:  Node.js v10.24.0  Npm missing - Exit

attached below the log from this run.

what I do, as I always forget to "sudo": I do a "sudo su -" at the beginning to have (and stay) at a root shell.
but, I also tried without. did not help. :-/

thank you!

Already have nodejs v10.24.0
OLD nodejs 10 :
NEW nodejs 16 :
Installing nodejs 16 over 10 .

***************************************

Started : Tue 13 Dec 15:15:25 CET 2022
Running for user root at /root
Failed to stop nodered.service: Unit nodered.service not loaded.
Found global nodes:   :

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
Package 'nodered' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Installing nodejs 16

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
Package 'nodejs-legacy' is not installed, so not removed
Package 'npm' is not installed, so not removed
The following packages were automatically installed and are no longer required:
  libbrotli1 libc-ares2 libnode64 libuv1 nodejs-doc
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  nodejs
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 154 kB disk space will be freed.
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 154 kB disk space will be freed.
(Reading database ... ^M(Reading database ... 5%^M(Reading database ... 10%^M(Reading database ... 15%^M(Reading database ... 20%^M(Reading database ... 25%^M(Reading database ... 30%^M(Reading database ... 35%^M(Reading database ... 40%^M(Reading database ... 45%^M(Reading database ... 50%^M(Reading database ... 55%^M(Reading database ... 60%^M(Reading database ... 65%^M(Reading database ... 70%^M(Reading database ... 75%^M(Reading database ... 80%^M(Reading database ... 85%^M(Reading database ... 90%^M(Reading database ... 95%^M(Reading database ... 100%^M(Reading database ... 41588 files and directories currently installed.)^M
Removing nodejs (10.24.0~dfsg-1~deb10u2) ...^M
Processing triggers for man-db (2.8.5-2) ...^M
dpkg: warning: ignoring request to remove nodejs which isn't installed
dpkg: warning: ignoring request to remove node which isn't installed

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
  libbrotli1 libc-ares2 libnode64 libuv1 nodejs-doc
0 upgraded, 0 newly installed, 5 to remove and 0 not upgraded.
After this operation, 28.3 MB disk space will be freed.
(Reading database ... ^M(Reading database ... 5%^M(Reading database ... 10%^M(Reading database ... 15%^M(Reading database ... 20%^M(Reading database ... 25%^M(Reading database ... 30%^M(Reading database ... 35%^M(Reading database ... 40%^M(Reading database ... 45%^M(Reading database ... 50%^M(Reading database ... 55%^M(Reading database ... 60%^M(Reading database ... 65%^M(Reading database ... 70%^M(Reading database ... 75%^M(Reading database ... 80%^M(Reading database ... 85%^M(Reading database ... 90%^M(Reading database ... 95%^M(Reading database ... 100%^M(Reading database ... 41576 files and directories currently installed.)^M
Removing libnode64:armhf (10.24.0~dfsg-1~deb10u2) ...^M
Removing libbrotli1:armhf (1.0.7-2+deb10u1) ...^M
Removing libc-ares2:armhf (1.14.0-1+deb10u1) ...^M
Removing libuv1:armhf (1.24.1-1+deb10u1) ...^M
Removing nodejs-doc (10.24.0~dfsg-1~deb10u2) ...^M
Processing triggers for libc-bin (2.28-10+rpt2+rpi1+deb10u1) ...^M
Grab the LTS bundle

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
curl is already the newest version (7.64.0-4+deb10u3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
/dev/fd/63: line 470: -E: command not found

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  libbrotli1 libc-ares2 libnode64 libuv1 nodejs-doc
Suggested packages:
  npm
The following NEW packages will be installed:
  libbrotli1 libc-ares2 libnode64 libuv1 nodejs nodejs-doc
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 6,360 kB of archives.
After this operation, 28.4 MB of additional disk space will be used.
Get:1 http://debian.anexia.at/raspbian/raspbian buster/main armhf libbrotli1 armhf 1.0.7-2+deb10u1 [257 kB]
Get:2 http://debian.anexia.at/raspbian/raspbian buster/main armhf libc-ares2 armhf 1.14.0-1+deb10u1 [80.9 kB]
Get:3 http://debian.anexia.at/raspbian/raspbian buster/main armhf libuv1 armhf 1.24.1-1+deb10u1 [96.9 kB]
Get:4 http://debian.anexia.at/raspbian/raspbian buster/main armhf libnode64 armhf 10.24.0~dfsg-1~deb10u2 [4,863 kB]
Get:5 http://debian.anexia.at/raspbian/raspbian buster/main armhf nodejs armhf 10.24.0~dfsg-1~deb10u2 [87.8 kB]
Get:6 http://debian.anexia.at/raspbian/raspbian buster/main armhf nodejs-doc all 10.24.0~dfsg-1~deb10u2 [975 kB]
Fetched 6,360 kB in 2s (2,882 kB/s)
Selecting previously unselected package libbrotli1:armhf.^M
(Reading database ... ^M(Reading database ... 5%^M(Reading database ... 10%^M(Reading database ... 15%^M(Reading database ... 20%^M(Reading database ... 25%^M(Reading database ... 30%^M(Reading database ... 35%^M(Reading database ... 40%^M(Reading database ... 45%^M(Reading database ... 50%^M(Reading database ... 55%^M(Reading database ... 60%^M(Reading database ... 65%^M(Reading database ... 70%^M(Reading database ... 75%^M(Reading database ... 80%^M(Reading database ... 85%^M(Reading database ... 90%^M(Reading database ... 95%^M(Reading database ... 100%^M(Reading database ... 41433 files and directories currently installed.)^M
Preparing to unpack .../0-libbrotli1_1.0.7-2+deb10u1_armhf.deb ...^M
Unpacking libbrotli1:armhf (1.0.7-2+deb10u1) ...^M
Selecting previously unselected package libc-ares2:armhf.^M
Preparing to unpack .../1-libc-ares2_1.14.0-1+deb10u1_armhf.deb ...^M
Unpacking libc-ares2:armhf (1.14.0-1+deb10u1) ...^M
Selecting previously unselected package libuv1:armhf.^M
Preparing to unpack .../2-libuv1_1.24.1-1+deb10u1_armhf.deb ...^M
Unpacking libuv1:armhf (1.24.1-1+deb10u1) ...^M
Selecting previously unselected package libnode64:armhf.^M
Preparing to unpack .../3-libnode64_10.24.0~dfsg-1~deb10u2_armhf.deb ...^M
Unpacking libnode64:armhf (10.24.0~dfsg-1~deb10u2) ...^M
Selecting previously unselected package nodejs.^M
Preparing to unpack .../4-nodejs_10.24.0~dfsg-1~deb10u2_armhf.deb ...^M
Unpacking nodejs (10.24.0~dfsg-1~deb10u2) ...^M
Selecting previously unselected package nodejs-doc.^M
Preparing to unpack .../5-nodejs-doc_10.24.0~dfsg-1~deb10u2_all.deb ...^M
Unpacking nodejs-doc (10.24.0~dfsg-1~deb10u2) ...^M
Setting up libbrotli1:armhf (1.0.7-2+deb10u1) ...^M
Setting up libc-ares2:armhf (1.14.0-1+deb10u1) ...^M
Setting up libuv1:armhf (1.24.1-1+deb10u1) ...^M
Setting up libnode64:armhf (10.24.0~dfsg-1~deb10u2) ...^M
Setting up nodejs-doc (10.24.0~dfsg-1~deb10u2) ...^M
Setting up nodejs (10.24.0~dfsg-1~deb10u2) ...^M
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode^M
Processing triggers for libc-bin (2.28-10+rpt2+rpi1+deb10u1) ...^M
Processing triggers for man-db (2.8.5-2) ...^M

Versions: node:v10.24.0 npm:missing

@jbudd

root@raspberrypi:~# curl -V
curl 7.64.0 (arm-unknown-linux-gnueabihf) libcurl/7.64.0 OpenSSL/1.1.1n zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) libssh2/1.8.0 nghttp2/1.36.0 librtmp/2.3
Release-Date: 2019-02-06
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL 
root@raspberrypi:~# uname -a
Linux raspberrypi 5.10.103-v7+ #1529 SMP Tue Mar 8 12:21:37 GMT 2022 armv7l GNU/Linux
root@raspberrypi:~# 

7.64.0 is the same version I have and the install script works for me. So no clues there.

Seductive as it is to always have sudo superpowers, you inevitably store up problems for yourself in the future.

How much have you done as root with this "fresh raspbian" installation?

If you reinstall RPiOS, update the OS and then try the normal Node-red install script, does it still fail?

No, do NOT use sudo for running the script.

You did not answer the question, unless I missed it

What is at and around, line 470 of the script?

sorry.

    465                 echo -ne "  Remove old version of Node.js       \033[1;32m\u2714\033[0m   $nv2\r\n"
    466                 echo "Grab the LTS bundle" | $SUDO tee -a /var/log/nodered-install.log >>/dev/null
    467                 echo -ne "  Install Node.js $NODE_VERSION LTS              \r"
    468                 # use the official script to install for other debian platforms
    469                 $SUDO apt install -y curl 2>&1 | $SUDO tee -a /var/log/nodered-install.log >>/dev/null
    470                 curl -sSL https://deb.nodesource.com/setup_$NODE_VERSION.x | $SUDO -E bash - 2>&1 | $SUDO tee -a /var/log/nodered-install.log >>/dev/null
    471                 if $SUDO apt install -y nodejs 2>&1 | $SUDO tee -a /var/log/nodered-install.log >>/dev/null; then CHAR=$TICK; else CHAR=$CROSS; fi
    472                 echo -ne "  Install Node.js $NODE_VERSION LTS              $CHAR"
    473             fi
    474         fi
    475 
    476         NUPG=$CHAR

i did apt upgrade it so far, and tried to install node red, nothing else.

I am ran now the script without sudo (or in my case without the root-shell) and it looks working now. :slight_smile:
just wondering, I have an old setup with node red where I ran the script in the past ( > 2 years) to setup, and frequently update the node red installation there with the same script (last time about 2 month ago). there not in a sudo root shell, but in the pure root shell where I am logged in as root.

strange that it fails with sudo then.

thank you for your help! :slight_smile:

If you run the install script as root:

  1. It warns you that you should not do so.

  2. It sets SUDO=''

  3. At line 470 it tries to ececute $SUDO -E. Since $SUDO is empty this gives an error -E: command not found.

This is NOT the same issue as reports of curl and/or ping raw.gituserhub.com failing.

I guess you could argue that there is an error in the script here. Simple to fix for anyone who has the knowledge and need to install as root.

indeed this is a bug - - now fixed in latest script.

You have inserted SUDOE=sudo -E
This won't work, it gives the same error -E: command not found (but at a different line in the script.)
I'm not sure if SUDOE='sudo -E' will work either.

Out of interest, what environment variables do you need to pass to bash at that point in the script (ie downloading and executing the node.js install script)?

Is sudo -E any different from exporting every variable assignment in the parent script - export Foo=Bar (which my fingers type without conscious effort)?

Why does the script generally avoid using sudo if the user is root? I know root can use sudo, not sure what effect it has.

Doh. More haste less speed…. Will re-fix. Which line is it flagging now ?
Not all OS have sudo installed, especially some of the smaller ones that default to only having root user.

It's flagging the line where you define SUDOE

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.