I am trying to install the latest version of Node-Red using the Raspberry Pi instructions using the command: bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
I get a bad install on the Node.js 20 update.
Stop Node-RED ✔
Remove old version of Node-RED ✔
Using N to manage Node.js +
Update Node.js 20 ✘ Bad install: Node.js missing Npm missing - Exit cache
What could I try to resolve this?
The log shows this:
Started : Tue 07 Jan 2025 12:04:26 PM EST
Running for user pi at /home/pi
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.
Using n
copying : node/20.18.1
node: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by node)
/usr/local/bin/node: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /usr/local/bin/node)
installed : (with npm )
Versions: node:missing npm:missing
EDIT: I am running the Buster OS on the Raspberry Pi and came across something suiggesting this is the issue. Can anyone confirm this or suggest an upgrade path?
You seem to be using the n version manager for node.js. This is generally a poor experience because every time you change version, you loose every node.js package you had installed.
Happened to me as well, trying to run the script to upgrade an RPi4 that was still running rather old versions (node 16.16.0 and NR 3.0.1)
The script failed completely and destroyed my setups, making everything unusable. Got the same error message as above. Tried a lot to install node etc but nothing helped
Lucky I was anyway, since on all my RPi's I have a small SD reader and an additional SD card having a fresh backup. Just swapping SD cards and I was up running again (quickly starting making a new SD card copy to be prepared)
But now, what is the correct steps to take? Running the script again is a no-go. I believe I should update node to a higher version, to prevent the script from touching that part
But what are the recommended steps now to follow??
I will start by making it clear that this is just my opinion - make of it what you will.
But I always prefer to take control of software installations even if that means a bit more work up-front understanding things.
I think that this is a good illustrative point. It is easy enough to get into a mess by following someone else's install script without understanding the possible edge-cases.
Dave's Debian/Rasbian install script is a work of art, to be sure! But no script can ever cover all the possibilities.
My personal recommendation to you would be to:
Make sure you have a current backup of your ~/.node-red folder.
Stop & disable Node-RED (something like sudo systemctrl disable node-red)
Delete the ~/.node-red/node-modules/ folder.
Uninstall node-red (npm -g remove node-red) and any other related global installs.
Remove any nodejs version managers like n.
Remove any remaining traces of node.js installations.
Now you should have a fairly clean baseline.
Update your OS
Install node.js LTS - from the community maintained debian nodejs repository, not from the actual Debian repo. This will be maintained simply with an OS update.
Then install Node-RED and any other dependencies you need.
Go into ~/.node-red/ folder and do an npm install. Check for any errors and correct them.
Run npm outdated and then npm update or other installs to get all of your nodes to the current versions.
Now you should be able to enable and start node-red again via systemctrl
From then on, you simply need to periodically run sudo apt update && sudo apt upgrade, run npm update in ~/.node-red/, do a sudo npm -g update.
Check that everything is working OK and then do a new backup.
After that you should be knowledgeable enough to be able to manage things even if you get an odd error for some reason. At least you will know all of the main moving parts and how to update/reinstall them all.
It is also a great idea to read through Dave's install script as you are doing all this so that you understand all the bits.
The maintenance of node-red and its components this way, while it may look complex in writing, is actually only a few steps, easily done.
I'm for sure willing to re-do the trial now that I have recovered the thing and made a new SD card copy, basically back where I started. But I would really like to follow the exact steps to reproduce so we know exactly what and in what order we should do things
I think it all went wrong when I added --node20 to the end of the script, upgrading of node then failed
NR version 3.0.1 and Node 16.16.0
The script stops since the node version is too old. I see that I have n installed but nvm is not
The following seems to be the first steps to do. Is that all and then try the script again?
Remove any nodejs version managers like n.
Remove any remaining traces of node.js installations.
sudo n prune
sudo npm uninstall -g n
sudo rm -r /usr/local/n
sudo rm /usr/local/bin/node
Now upgraded a number of RPi3's, running NR 2.2.2 and Node 16.16.0
Used the script directly since neither n or nvm was installed in those. Now running NR 4.0.8 and Node 18.20.5, working perfectly fine, all my units now running the latest
The problem with upgrading seems to be related to n. When n was installed, the script did not work for me, I did the above steps first. It seems, if n is not installed, the script handles the upgrade fine
Wonder why n was installed and where it came from since my older RPi3's didn't have them installed??
Just an additional note about all this with too old node versions...
If you are on an older (Linux) distribution on some of your computers it might be they do not support node versions from version 18 and higher. Means you will also not be able to upgrade Node-RED to later version
You basically have 3 options:
Upgrade your operating system
Stay on your current os version and instead build, compile and install your own version of glibc v2.28 and patch node. If successful, after this you can upgrade Node-RED
Do nothing and stay on a Node-RED version that still supports Node up to version 17
In my case, in addition to all the various RPi's, I have
NVIDIA Jetson Nano, running Ubuntu 18 w Node version 16
an old Lenovo laptop running Debian 9 w Node version 16
I felt alternative 2) would be the first thing to try. I found a nice guide here
Only thing missing in the guide where some additional steps:
cd glibc-2.28
mkdir glibc-build
cd glibc-build
../configure --prefix=/opt/glibc-2.28
make -j 4 # Use all 4 Jetson Nano cores for much faster building
make install
This worked successfully on my NVIDIA device, now it is upgraded and runs Node-RED 4.0.8 and Node version 20.18.1
On my laptop, I have so far failed. I have changed to the correct architecture x86_64 but the patching seems not to work (yet).