I am running on a Raspberry3 NR at V4.1 with underlaying node V18.20 which is the minimum setup.
As I experience some instability with my Pi I consider updating node to V20 or V22. Whats the best strategy to ensure no issues with the current NR installation?
Using the node red_installer.sh script with argument --node20 ?
Doing the basic stuff like npm update -g and npm cache clean -f
If you installed node-red using the script, best to use the script to make changes. I believe the script does everything necessary.
If you prefer to do things by hand. Install the new version of node.js - this requires manual installation or use of one of the 3rd-party repo's for Pi's follow the instructions on the node.js website. After upgrading, you should do:
Then restart node-red and reload the editor if you already have it open in a browser tab.
The rebuild commands will re-make compiled binary libraries using the new version of node.js and the latest c++ and header files and is important when moving to a new major version of node.js. They will do nothing if you don't have any binary libraries in use (but on a Pi, you will almost certainly have at least the serial nodes).
after that updates of nodejs and npm was as expected.
I skipped the step npm update in my .node-red directory as I intentionally need some old version of node_modules
Indeed, the official script does have a rather unwieldy name. On the occasions when I download it, I call it nrscript.
Just in case others are seeking how to do this, on Linux you don't need to run any other script than the official one. It does all the downloads and installs in the background.
Actually there are two official scripts, one for Debian based Linux and one for distributions using rpm - Reg Hat & co.
Not necessary, the script will do that for you bash <(curl -sL https://github.com/node-red/linux-installers/releases/latest/download/update-nodejs-and-nodered-deb) --node20
I recommend using 22 rather than 20. Use --node22 for that.