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
Remove old version of Node-RED
Remove old version of Node.js
/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
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 )
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
Here is the error I have now, after sucessfully installing lsb-release and re-booting.
Stop Node-RED
Remove old version of Node-RED
Remove old version of Node.js
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
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
Stop Node-RED
Remove old version of Node-RED
Remove old version of Node.js
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
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.
@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.