Node red upgrading question

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!


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.

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?

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.

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

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

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.

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?

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.

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

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