Backup list of installed nodes on palette

I have set up a process to backup my flows on restart of nodered. This is fine but, as I know to my cost, when you have multiple flows developed over years with many different interfaces, it is not so simple to just restore flows and then update the palette for unknown nodes.

Many node flow groups, created and available in palette, have conflicting named nodes. For example, "e-mail in" is created in 5 different node groups in palette. I found that, if I did not recall exactly which one I had installed before, and installed the wrong one, Node Red does not make it easy to simply remove. In fact in this case, it threw an error and would not let me simply uninstall. It took some effort to override this error and work through the node flow groups until I found the correct one. So it would be useful if, at the same time as I backed up the actual flows, I could also create a list of the installed node flow groups. Is that possible?

A node cannot have the same name in two different installed packages. So you should get an error when starting node-red or installing a node with a duplicate. So you should never be able to have >1 email-in node.

Also, when you hover over a node in the left sidebar, it tells you what package it comes from:
image

And finally, all node packages are defined in the package.json file in your userDir. You should be backing this up along with everything else. Indeed there are a number of files/folders that need to be backed up and, in general, you should always back up the whole userDir folder minus any node_modules folders.

I understand about conflicts. The issuewas tha if i did not know the package a node came from, i could install the wrong one when manually restoring.

However, the rest of your info will help me. I will look at backing up the folders you suggested

There is no need to manually install the additional nodes. If you restore package.json and then go into your userDir (commonly .node-red) and run
npm install
it will install all the nodes for you. In addition, if you also restore package-lock.json then it will install the same version of those nodes as was previously installed, rather than the latest compatible version.

So if I import a flow from flows.nodered.org which includes a node "email-in", npm install will know where it comes from and correctly install it (provided that it doesn't result in a name conflict)?
How does it know where it comes from?
Will it at the same time update all nodes?

No, I was referring to restoring a flows file from a backup (which is the subject of this thread). The nodes required are defined in package.json, which should be backed up along with the flows file, and other stuff.

No. If a flow needs a node, you have to install it yourself. If you import a flow containing references to nodes that aren't installed, you will see those nodes with red dotted outlines and telling you that it is an unknown node.

It doesn't.

Not sure what you mean. Importing a flow simply adds the flow JSON data (that defines the flow) to your existing flows json. That is visible in the editor. Nothing else.

I was unsure if @Colin's suggestion of npm install was relevant only to restoring from backups or also uninstalled nodes in other circumstances. Clearly it's dependent on the data in package.json.

Yes, that is correct. npm install with no further package name(s) just ensures that everything in the dependencies section of the package.json file is installed according to the specified version ranges. Great for restoring backups or implementing a new instance from a template package. Or, on those odd occasions where an installed package gets messed up (maybe from using applying updates from an npm audit "recommendation" - don't do that) and you simply delete the whole node_modules folder and then npm install. Everything gets rebuilt.

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