The install script tells me I have Node.js v 20.20.2 and NPM v10.8.2 and Node Red 5.0.0. Does the script not also update Node.js?
I've always used this script with no problems however after trying a couple of times I keep getting the following error (NR log) when I restart Node Red:
Starting as a systemd service.
Started nodered.service - Node-RED graphical event wiring tool.
Unsupported version of Node.js: v20.20.2
Node-RED requires Node.js v22.9 or later
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.
nodered.service: Scheduled restart job, restart counter is at 7.
Stopped nodered.service - Node-RED graphical event wiring tool.
Started nodered.service - Node-RED graphical event wiring tool.
Unsupported version of Node.js: v20.20.2
Node-RED requires Node.js v22.9 or later
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.
So I updated Node.js to v24.17.0 using instructions from this site:
yet NR still would not start.
node -v reports 24.17.0 npm -v reports 11.13.0
I rebooted the system and NR did not automatically start. I used node-red-start and the log reports:
Unsupported version of Node.js: v20.20.2
Node-RED requires Node.js v22.9 or later
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.
nodered.service: Scheduled restart job, restart counter is at 2.
Stopped nodered.service - Node-RED graphical event wiring tool.
Started nodered.service - Node-RED graphical event wiring tool.
Unsupported version of Node.js: v20.20.2
Node-RED requires Node.js v22.9 or later
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.
I just fell into the same trap - an SD card with an old version of Node-red on it.
I disabled automatic startup (removed the systemd link), deleted the default systemd script and removed the entire ~/.node-red directory.
Then I ran the script with no command line flags. It seemed to run OK but the resulting Node-red v5 will not run because node.js 20.0 was previously installed.
Of course it's simple to re-run with --node24 but I think it's a mistake for the script with default options to leave you with an installation that won't run.
Also, the script output can be misinterpreted
This script checks if Node.js is installed, and will try to install
Node.js 24 if it is not found.
And as @StrongTown discovered, it's easy to go down the wrong route trying to upgrade Node.js.
ps Re-running with --node24 also gives misleading output - "No Node.js detected"
Removing any existing Node.js and npm...
No Node.js detected - will try to install Node.js 24
Install Node.js _
That is a bit misleading, but also correct. There is no nodejs detected because it has just been removed. It would be better if the 'no nodejs detected' bit was not output if it had just been removed by the script.
I also agree it would be good if the script showed a warning if the installed version is too low, with a suggestion as to what to do about it.
All - apologies - I thought I had fixed those a couple of weeks ago - but it seems the release script failed at the last step and didn't update the "live” version... it should now auto update to 24 if it detects versions earlier than nodejs 22.9 (or to latest 22 if running on Arm v6)
What do you think about a --force option for the script, with the aim of completely replacing an old or broken installation with the latest release?
If --force is specified, provided the OS is 64 bit, [re]install the default node.js (depending on Arm processor version), [re]install the latest Node-red, replace any existing settings.js and systemd scripts with the default, run admin init.