Installation failure on Rasp Pi running up to date Raspian Buster 10

My rasp pi runs Raspian Buster 10.
I have just updated everything sucessfully followed by a re-boot.
When I run the below installation command

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

I get the below error in the terminal.

Running Node-RED install for user pi at /home/pi on raspbian

This can take 20-30 minutes on the slower Pi versions - please wait.

Stop Node-RED :heavy_check_mark:
Remove old version of Node-RED :heavy_check_mark:
Remove old version of Node.js :heavy_check_mark:
/dev/fd/63: line 296: lsb_release: command not found
Install Node.js LTS ✘ Failed to install Node.js - Exit
Install Node-RED core
Move global nodes to local

Below are lines 296 to 312 from the install script.
"lsb_release" is right there on 296, but I don't understand much more than that.

           if [[ $(lsb_release -d) == *"18.10"* ]]; then 
                 echo -ne "  Apt install Node.js                 \r" 
                 if sudo apt install -y nodejs npm curl 2>&1 | sudo tee -a /var/log/nodered    -install.log >>/dev/null; then CHAR=$TICK; else CHAR=$CROSS; fi 
                 echo -ne "  Apt install Node.js                 $CHAR" 
             else 
                 echo -ne "  Install Node.js LTS                 \r" 
                 # use the official script to install for other debian platforms 
                 sudo apt install -y curl 2>&1 | sudo tee -a /var/log/nodered-install.log >    >/dev/null 
                 OV=`cat /etc/os-release | grep VERSION_ID | cut -d '"' -f 2` 
                 if [[ "$OV" = "8" ]]; then 
                     curl -sSL https://deb.nodesource.com/setup_10.x | sudo -E bash - 2>&1     | sudo tee -a /var/log/nodered-install.log >>/dev/null 
                 else 
                     curl -sSL https://deb.nodesource.com/setup_12.x | sudo -E bash - 2>&1     | sudo tee -a /var/log/nodered-install.log >>/dev/null 
                 fi 
                 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 
                 echo -ne "  Install Node.js LTS                 $CHAR" 
             fi

Any ideas?

What happens if you enter lsb_release -d on a terminal?

You should see Description: Ubuntu 18.04.3 LTS or similar

It seems not all Debian builds have lsb_release . For example, even the official Ubuntu Docker image does not have lsb_release. (reference)

perhaps you could apt-get install that?
sudo apt-get install lsb-core

EDIT...
@dceejay perhaps a bug in the installer script? I see in the else clause you do cat /etc/os-release but the OPs install seems to trip up here? (this area of computing is not is not my strongest suit so i may be way off - please tell me to do one if necessary :stuck_out_tongue_winking_eye: )

1 Like

Too much "legacy" stuff in there I think - trying to keep old stuff going when we should really just abandon it. About time I bit the bullet and just moved it all up to node12.

but yes in terms of this issue installing lsb-core should fix it. (though it's in my version of buster :frowning:

3 Likes

Thanks for the reply. Here is the output

pi@raspberrypi:~ $ lsb_release -d
-bash: lsb_release: command not found

Installed it with

sudo apt-get install -y lsb-release

Now I get

pi@raspberrypi:~ $ lsb_release -d
Description: Raspbian GNU/Linux 10 (buster)

Here is the error I have now, after sucessfully installing lsb-release and re-booting.

Stop Node-RED :heavy_check_mark:
Remove old version of Node-RED :heavy_check_mark:
Remove old version of Node.js :heavy_check_mark:
Install Node.js LTS ✘ Failed to install Node.js - Exit
Clean npm cache
Install Node-RED core
Move global nodes to local
Install extra Pi nodes
Npm rebuild existing nodes
Add shortcut commands
Update systemd script

Log file at link. I wasn't allowed to post all the links the log contains
https://www.dropbox.com/s/c3fzbif6wlv11xh/nodered-install.log?dl=0

hmm . ok. looks like we got into a half in and half not in situation... to clean up do a
sudo apt remove -y nodejs nodejs-legacy npm
then lets get nodejs manually

curl -sSL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt install -y nodejs
node -v && npm -v

should get you node 12 and npm 6.14
then re-run the script ...

1 Like

Thanks. Here is the output

pi@raspberrypi:~ $ node -v && npm -v
v10.21.0
-bash: npm: command not found

Seems to have installed Node 10.21 and no npm.

pi@raspberrypi:~ $ node -v
v10.21.0

pi@raspberrypi:~ $ npm -v
-bash: npm: command not found

which Pi is this ? what does uname -m say ?
after the sudo apt remove - what does which node report ?

1 Like

I was looking down the same rabbit hole!
It's an Arm 7!!

pi@raspberrypi:~ $ uname -m
armv7l

ok - so repeat the

sudo apt purge -y nodejs
node -v
which node

to check it's been removed...

1 Like

Thanks. I got it installed with these

wget https://nodejs.org/dist/v12.19.0/node-v12.19.0-linux-armv7l.tar.xz
tar -xvf node-v12.19.0-linux-armv7l.tar.xz
cd node-v12.19.0-linux-armv7l/
sudo cp -R * /usr/local/
node -v

v12.19.0

npm -v

6.14.8

Now I have Node 12.19 and NPM 6.14.

I will now re-run the script.

1 Like

Still errors

Stop Node-RED :heavy_check_mark:
Remove old version of Node-RED :heavy_check_mark:
Remove old version of Node.js :heavy_check_mark:
Install Node.js LTS ✘ Failed to install Node.js - Exit
Clean npm cache
Install Node-RED core
Move global nodes to local
Install extra Pi nodes
Npm rebuild existing nodes
Add shortcut commands
Update systemd script

Log here Dropbox - File Deleted - Simplify your life

Got it going with

sudo npm install -g --unsafe-perm node-red

Thanks for all your help

that's still odd - the log says -
Versions: node:v10.21.0 npm:
where is it getting that from now that you removed it and added 12 ?

what does which node return please ?

Hi @dceejay

Thank you for your help, which kept me going through the node red install, which is always worth it for the end goal of having node red.

Much appreciated. It definatley helped me along the way..

The installation script, on the node red site, in my opinion surpasses the KISS principle, looking rather unweildly.

As someone who years ago faintly got to know LAMP stacks, I still really have no idea what node js, npm and nginx are. They always seem convoluted to me.
When I have used npm for some installation or another, eg node red, it looks like it is breaking stuff during the install, even if it works after the install.

Maybe a simple LAMP stack with a tarball install was not possible for the node red platform, but it would much reduce the barrier to entry for new comers entering the otherwise superb node red world.

Node red itself is superb.

I do wander if uptake of node red would increase significantly by reducing install barriers, through using better known / apparently simpler technology.

Here is the simple script I used to get node red working on a ARM 7 pi:


sudo apt-get install -y lsb-release


# remove any npm or node js already installed

# if u know where these are installed simple deletion of directorys will get rid of it
# be careful. Save any config files or flows

sudo apt remove -y nodejs nodejs-legacy npm


# Check whether you have Rasp Pi Arm 7 or Arm 8 processor with this command
# u need this to get the right file at the below web address
uname -m

# head over to here and down load the relevant file
#    https://nodejs.org/en/download/

# change to home dir
cd ~/

# download the relevant file, in this case Arm 7
wget https://nodejs.org/dist/v12.19.0/node-v12.19.0-linux-armv7l.tar.xz

# unpack it
tar -xvf node-v12.19.0-linux-armv7l.tar.xz

# change to newly created directory
cd node-v12.19.0-linux-armv7l/

# copy the files to /usr/local so they work
sudo cp -R * /usr/local/

# check the versions
node -v
# v12.19.0

npm -v
# 6.14.8

# change back to home dir
cd ~/

# install node red
# ps npm installs always look scary but often seem to work afterwards
sudo npm install -g --unsafe-perm node-red

# start node red with this command
node-red &

# surf to the node red interface on your laptop
http://your-pi-ip-here:1880

The problem is that your script would not be sufficient for many users. Just a couple of examples, it will not work on a Pi Zero, or Ubuntu and it does not cope with a system which already has an old version of nodejs installed.
Also it does not setup service scripts for starting node-red on boot.
There are lots of other situations it won't cope with if I thought about it a bit longer.

1 Like

@Colin

Ok.

Thanks.

There's always a caveat, I understand that, and yes, I didn't think of ubuntu, zeros or other systems, or start service on boot.

No doubt maintaining the script is a challenge for the maintainer.

So much qdos to who ever does that. It is appreciated.

It occured to me that I only needed 13 SLOC for the ARM 7 pi install.

I do understand that the picture will be bigger than I see. I try to undertand that most of life works that way.

@Colin thanks. That got me thinking.
It's also likley that so much investment, time etc, has gone into development on the npm technology platform etc that moving to something else not practically possible.
U made a good point about adaptability of the install script.