# Update Script installs NodeJS 10 instead of 16

**URL:** <https://discourse.nodered.org/t/update-script-installs-nodejs-10-instead-of-16/71510>\
**Category:** Dashboard\
**Created:** [30 November 2022 14:51 UTC](https://discourse.nodered.org/t/update-script-installs-nodejs-10-instead-of-16/71510 "2022-11-30T14:51:28Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![DerMega](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@DerMega](https://discourse.nodered.org/u/DerMega)\
**Post date:** [30 November 2022 14:51 UTC](https://discourse.nodered.org/t/update-script-installs-nodejs-10-instead-of-16/71510/1 "2022-11-30T14:51:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [30 November 2022 15:02 UTC](https://discourse.nodered.org/t/update-script-installs-nodejs-10-instead-of-16/71510/2 "2022-11-30T15:02:44Z")

</div>

Can you firstly try the following?

```auto
$ 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
v16.18.0

$ /usr/bin/nodejs --version
v16.18.0

```

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)](https://github.com/nodesource/distributions/blob/master/README.md)

---

<div class="post-metadata">

**Author:** ![DerMega](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@DerMega](https://discourse.nodered.org/u/DerMega)\
**Post date:** [30 November 2022 15:12 UTC](https://discourse.nodered.org/t/update-script-installs-nodejs-10-instead-of-16/71510/3 "2022-11-30T15:12:32Z")

</div>

The Answers are:

```auto
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
v10.24.1

/usr/bin/nodejs --version
v10.24.1

```

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

---

<div class="post-metadata">

**Author:** ![DerMega](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@DerMega](https://discourse.nodered.org/u/DerMega)\
**Post date:** [1 December 2022 06:24 UTC](https://discourse.nodered.org/t/update-script-installs-nodejs-10-instead-of-16/71510/4 "2022-12-01T06:24:19Z")

</div>

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. 🙂

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [1 December 2022 09:57 UTC](https://discourse.nodered.org/t/update-script-installs-nodejs-10-instead-of-16/71510/5 "2022-12-01T09:57:11Z")

</div>

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:

```auto
# 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

```

---

<div class="post-metadata">

**Author:** ![DerMega](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@DerMega](https://discourse.nodered.org/u/DerMega)\
**Post date:** [1 December 2022 12:10 UTC](https://discourse.nodered.org/t/update-script-installs-nodejs-10-instead-of-16/71510/6 "2022-12-01T12:10:48Z")

</div>

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

npm rebuild?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [1 December 2022 14:17 UTC](https://discourse.nodered.org/t/update-script-installs-nodejs-10-instead-of-16/71510/7 "2022-12-01T14:17:30Z")

</div>

`npm install`  
from inside the .node-red folder.

---

<div class="post-metadata">

**Author:** ![DerMega](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@DerMega](https://discourse.nodered.org/u/DerMega)\
**Post date:** [2 December 2022 12:51 UTC](https://discourse.nodered.org/t/update-script-installs-nodejs-10-instead-of-16/71510/8 "2022-12-02T12:51:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 December 2022 13:44 UTC](https://discourse.nodered.org/t/update-script-installs-nodejs-10-instead-of-16/71510/9 "2022-12-02T13:44:52Z")

</div>

> [@DerMega](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [16 December 2022 13:45 UTC](https://discourse.nodered.org/t/update-script-installs-nodejs-10-instead-of-16/71510/10 "2022-12-16T13:45:43Z")

</div>

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