# Node red upgrading question

**URL:** <https://discourse.nodered.org/t/node-red-upgrading-question/76428>\
**Category:** General\
**Created:** [11 March 2023 11:17 UTC](https://discourse.nodered.org/t/node-red-upgrading-question/76428 "2023-03-11T11:17:11Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Surefire01](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/surefire01/32/71490_2.png) [@Surefire01](https://discourse.nodered.org/u/Surefire01)\
**Post date:** [11 March 2023 11:17 UTC](https://discourse.nodered.org/t/node-red-upgrading-question/76428/1 "2023-03-11T11:17:11Z")

</div>

Chaps  
Following on from a previous issue I had with node red earlier this week, it was suggested that I upgrade from version 3.0.0 to the latest which seems to be 3.0.2. My current node red instance is running on my raspberry pi 4 and controls my central heating. It has quite a few additional nodes installed, uses MQTT broker and is working pretty well. If I upgrade to the latest version will I have to install all the special nodes again and will I have to re-enter all the topic information into my MQTT in and out nodes of which I have many? Of course I can save the flows and import them again but if I have to manually install and re-enter all the configuration info into loads of nodes I think I'll wait till summer!

Thanks

---

<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:** [11 March 2023 11:21 UTC](https://discourse.nodered.org/t/node-red-upgrading-question/76428/2 "2023-03-11T11:21:58Z")

</div>

> [@Surefire01](#):
>
> If I upgrade to the latest version will I have to install all the special nodes again and will I have to re-enter all the topic information into my MQTT in and out nodes of which I have many?

No. An upgrade never removes any existing data.

Of course, it is ALWAYS advisable to have a backup of your userDir folder (minus any embedded `node_modules` folders. If you have the space, you can do a simple copy of the folder.

---

<div class="post-metadata">

**Author:** ![Surefire01](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/surefire01/32/71490_2.png) [@Surefire01](https://discourse.nodered.org/u/Surefire01)\
**Post date:** [11 March 2023 11:32 UTC](https://discourse.nodered.org/t/node-red-upgrading-question/76428/3 "2023-03-11T11:32:26Z")

</div>

So to be clear, you can assure me with reasonable confidence that I just need to run the bash install script and after a while when the latest version of Node red is installed and running I will have to do very little if anything to get my flows running the way they were?

---

<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:** [11 March 2023 11:38 UTC](https://discourse.nodered.org/t/node-red-upgrading-question/76428/4 "2023-03-11T11:38:40Z")

</div>

Yes. BUT, always do a backup of your userDir folder first!

I think that I've twice (in \>a decade) had an upgrade that caused an issue that meant I used my backup. Though even then I could have recovered with some faffing. So it isn't entirely unheard of. But very rare. In any case, a simple copy of `~/.node-red` is all you need. Will take a bit of time to finish on a Pi but it is only 1 `cp` command: `cp /home/pi/.node-red /home/pi/.node-red-copy` should do it.

But a move from 3.0.0 to 3.0.2 is only a minor upgrade anyway so virtually no chance of anything untoward happening.

---

<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:** [11 March 2023 11:39 UTC](https://discourse.nodered.org/t/node-red-upgrading-question/76428/5 "2023-03-11T11:39:28Z")

</div>

To do the upgrade (after making sure your backup is up to date) then all you need to do is to open a command window and run  
`sudo npm install -g --unsafe-perm node-red`  
Then do  
`node-red-stop`  
`node-red-start`  
or  
`node-red-reload`  
which stops and restarts it.

If you do ever need to restore from a backup, restore everything back to the .node-red directory except the node\_modules directory (in fact you don't need to back that up), then go into that directory and run  
`npm install`  
that will install all the additional nodes that you had before. It knows what they are from information in package.json and package-lock.json.

---

<div class="post-metadata">

**Author:** ![stephenn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stephenn/32/66644_2.png) [@stephenn](https://discourse.nodered.org/u/stephenn)\
**Post date:** [11 March 2023 12:22 UTC](https://discourse.nodered.org/t/node-red-upgrading-question/76428/6 "2023-03-11T12:22:27Z")

</div>

> [@Colin](#):
>
> If you do ever need to restore from a backup, restore everything back to the .node-red directory except the node\_modules directory (in fact you don't need to back that up), then go into that directory and run  
> `npm install`  
> that will install all the additional nodes that you had before. It knows what they are from information in package.json and package-lock.json.

Ugh! I didn't know that. Thanks for the education. I had some issues about a year ago and added each pallet back manually. I only backup the minimum files needed to Dropbox, not the entire directory

---

<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:** [11 March 2023 12:44 UTC](https://discourse.nodered.org/t/node-red-upgrading-question/76428/7 "2023-03-11T12:44:00Z")

</div>

> [@stephenn](#):
>
> I only backup the minimum files needed to Dropbox, not the entire directory

The minimum files/folders are everything in `~/.node-red` minus any `node_modules` folders. Lots of things create files/folders under that folder (the `userDir` folder). You won't want to lose them.

---

<div class="post-metadata">

**Author:** ![Surefire01](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/surefire01/32/71490_2.png) [@Surefire01](https://discourse.nodered.org/u/Surefire01)\
**Post date:** [11 March 2023 13:07 UTC](https://discourse.nodered.org/t/node-red-upgrading-question/76428/8 "2023-03-11T13:07:48Z")

</div>

Just tried this from TotallyInformation's post:

cp /home/pi/.node-red /home/pi/.node-red-copy

and got this message:  
cp: -r not specified; omitting directory '/home/pi/.node-red'

What does this mean?

---

<div class="post-metadata">

**Author:** ![Surefire01](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/surefire01/32/71490_2.png) [@Surefire01](https://discourse.nodered.org/u/Surefire01)\
**Post date:** [11 March 2023 13:26 UTC](https://discourse.nodered.org/t/node-red-upgrading-question/76428/9 "2023-03-11T13:26:38Z")

</div>

It's OK folks just used the -r switch to copy folders and files recursively after a bit of a search around a Linux site.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [11 March 2023 13:35 UTC](https://discourse.nodered.org/t/node-red-upgrading-question/76428/10 "2023-03-11T13:35:48Z")

</div>

An alternative Linux command to backup everything in **.node-red** except for the **node\_modules** directory:

**cd ~**  
**tar --exclude="node\_modules" -cvf nodered.bak.tar .node-red**

This will create a single backup archive **nodered.bak.tar**.

To see what it contains: **tar tvf nodered.bak.tar** (-t lists archive contents)  
To extract everything, ovewriting files currently in .node-red: **tar xvf nodered.bak.tar** (-x extracts fom archive)  
To extract a single file eg settings.js: **tar xvf nodered.bak.tar .node-red/settings.js**

---

<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:** [10 May 2023 13:36 UTC](https://discourse.nodered.org/t/node-red-upgrading-question/76428/11 "2023-05-10T13:36:48Z")

</div>

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