Update Node.js 12.22.9 to latest version question


On my Raspberry Pi 3b+ with Raspbian Buster I want to update Zigbee2mqtt to the latest version.
However this version uses Nodejs 14 or higher and currently the raspberry pi runs Node-red 12.22.9

If I update Node-Red with the recommended command I get the message that this version needs 14 or higher

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

Now I have read that adding --node14 or --node16 will force to install Node-Red 3.0.
and run npm rebuild

If I run this update, which version would be best: --node14 or --node16?

Are there any other steps that need to be taken to ensure that the update is successful?


This is not a valid node-red version. That looks like a Home Assistant version number.

You may need to disable the home assistant plugin before installing node-red using the official script installer


Ah hold on.

You mean node-js NOT node-red!

Ok, then proceed with

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

Oh sorry you're right I meant node-js
I don't run Home Assistant but Domoticz instead along with Zigbee2MQTT
Do I have to stop both Zigbee2mqtt and Domoticz services before running the command?

No - should be fine.

Thanx I'll give it a try!

I see that the package also updates:
npm rebuild existing nodes

Isn't that the same command that I mentioned (I have read in the forum) to perform after the installation: npm rebuild?

Looks like it was succesfully installed

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       ✔   v12.22.9
  Install Node.js 16 LTS              ✔   v16.17.1   Npm 8.15.0
  Clean npm cache                     ✔
  Install Node-RED core               ✔   3.0.2
  Move global nodes to local          -
  Npm rebuild existing nodes          ✔
  Install extra Pi nodes              ✔
  Add shortcut commands               ✔
  Update systemd script               ✔

Any errors will be logged to   /var/log/nodered-install.log
All done.
You can now start Node-RED with the command  node-red-start
  or using the icon under   Menu / Programming / Node-RED
Then point your browser to localhost:1880 or http://{your_pi_ip-address}:1880

Started :  za 15 okt 2022 13:59:11 CEST 
Finished:  za 15 okt 2022 14:08:29 CEST
You may want to run   node-red admin init
to configure your initial options and settings.
pi@Domotica-Pi:~ $ node -v
pi@Domotica-Pi:~ $

Yes, the script does that for you. You only need to do it yourself if you manually install a different version of nodejs

Title changed to reflect the actual question.