Update Script installs NodeJS 10 instead of 16

Hey Guys,

I try to update my Node-Red via the script on a RPi3 with a buster installation.
The script detects nodejs v10.24.1 an uninstalls it. But then installs v10.24.1 again even when I force it to install nodejs 18 (--node18).
I then manually uninstalled nodejs and tried to run the script and it again installed nodejs v10.24.1.

Can anybody help me?
I´m lost.

Can you firstly try the following?

$ whereis nodejs
nodejs: /usr/bin/nodejs /usr/lib/nodejs /usr/share/man/man1/nodejs.1.gz

$ whereis node
node: /usr/bin/node /usr/include/node /usr/share/man/man1/node.1.gz

$ /usr/bin/node --version

$ /usr/bin/nodejs --version

This will help check whether you have a rogue version of node.js installed.

If you don't have a 2nd copy somewhere, you may try installing node.js 18 using the way recommended by the node project.

distributions/README.md at master · nodesource/distributions (github.com)

1 Like

The Answers are:

whereis nodejs
nodejs: /usr/bin/nodejs /usr/share/man/man1/nodejs.1.gz

whereis node
node: /usr/bin/node /usr/include/node /usr/share/man/man1/node.1.gz

/usr/bin/node --version

/usr/bin/nodejs --version

So I´ll try the recommendet way from your Link.

1 Like

Ok, that worked after I solved another problem which came up during the process but after installing node18 and running the script my node-red installation is completely screwed up.
I guess I´ll do a clean install of everything.
Just have to figure out how to copy my node red and zigbee2mqtt data bevore.
thx again. :slight_smile:

Depends whether you are going to completely wipe the device but Node-RED is fully encapsulated in the ~/.node-red userDir folder so just take a complete copy minus the ~/.node-red/node_modules/ folder which is enormous and easily recreated.

For Zigbee2MQTT, make a copy of the /opt/zigbee2mqtt/data folder. The official update process for Zigbee2MQTT overwrites everything anyway so having a backup of your data folder is important. This is the script I use to update it:

# Stop Zigbee2MQTT and go to directory
sudo systemctl stop zigbee2mqtt
cd /opt/zigbee2mqtt

# Backup configuration
cp -R data data-backup

# Update
git checkout HEAD -- npm-shrinkwrap.json
git pull
npm ci

# Restore configuration
cp -R data-backup/* data
rm -rf data-backup

# Start Zigbee2MQTT
sudo systemctl start zigbee2mqtt
1 Like

@TotallyInformation thanks for the input.
How do I recreate all the modules?

npm rebuild?

npm install
from inside the .node-red folder.

1 Like

Just a "dumb" question to this:
I have to know every module to reinstall it manually right?

No, provided you have got the package.json file, then running npm install from inside the .node-red folder will do that, as I said.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.