# What is the recommended way of upgrading Node on a Raspberry Pi?

**URL:** <https://discourse.nodered.org/t/what-is-the-recommended-way-of-upgrading-node-on-a-raspberry-pi/10679>\
**Category:** General\
**Created:** [30 April 2019 14:35 UTC](https://discourse.nodered.org/t/what-is-the-recommended-way-of-upgrading-node-on-a-raspberry-pi/10679 "2019-04-30T14:35:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheHypnoToad](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thehypnotoad/32/7979_2.png) [@TheHypnoToad](https://discourse.nodered.org/u/TheHypnoToad)\
**Post date:** [30 April 2019 14:35 UTC](https://discourse.nodered.org/t/what-is-the-recommended-way-of-upgrading-node-on-a-raspberry-pi/10679/1 "2019-04-30T14:35:07Z")

</div>

Hi,

I'm running NodeRED on a Raspberry Pi 2 and it works really well. I installed it using the guide [here](https://nodered.org/docs/hardware/raspberrypi) that says to run this script:

`bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)`

After a while it installed Node v8.x along with NodeRED 0.19.x - This was sometime last year I think.

Today I'm try to use this [node](https://flows.nodered.org/node/node-red-contrib-alexa-remote2) which requires Node v10

> works with node version 10 but not with node version 8!

So long story short I'd like to upgrade to Node v10 - I tried running the `update-nodejs-and-nodered` script again and it updates my Pi to NodeRED to v20.5 but my Node is still v8.

Should I try completely removing NodeRED and Node and running the `update-nodejs-and-nodered` script again? Or is there a better method?

I'm running Raspbian Stretch OS

---

<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:** [30 April 2019 15:34 UTC](https://discourse.nodered.org/t/what-is-the-recommended-way-of-upgrading-node-on-a-raspberry-pi/10679/2 "2019-04-30T15:34:52Z")

</div>

Stop node red then uninstall node 8.x  
`sudo apt-get remove nodejs`  
then remove the node 8.x repository spec  
`sudo rm /etc/apt/sources.list.d/nodesource.list`  
Then re-run the script.

---

<div class="post-metadata">

**Author:** ![TheHypnoToad](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thehypnotoad/32/7979_2.png) [@TheHypnoToad](https://discourse.nodered.org/u/TheHypnoToad)\
**Post date:** [2 May 2019 10:05 UTC](https://discourse.nodered.org/t/what-is-the-recommended-way-of-upgrading-node-on-a-raspberry-pi/10679/3 "2019-05-02T10:05:29Z")

</div>

Thanks very much, it took a while for the script to do it's thing but it all worked in the end. 🙂

I did see this message when removing nodejs

`Removing nodejs (8.12.0-1nodesource1) ... dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator' not empty so not removed`

But everything is working OK so I'm not going to go and tinker with the node\_modules files.
