Backing up installed nodes on Ubuntu?

I know this question was asked elsewhere and answered, but my problem expands and the answer does not apply to my case.

The VM I am using is a Ubuntu (I think the version is 21, or up, will post the exact version when I can check it in the office), and I installed node red on it, but the only package.json I could find and access in .node-red folder only contains about 4 or 5 lines.

Therefore it seems I have to reinstall every single one my self on a windows machine I want to use my flows on and that will make it a problem since I currently have half a dozen docker containers of node-red and if they would have this problem too I would have to reinstall these nodes each time I update the containers to a new version.
Any workaround for this??

Show us your package.json and also tell us a couple of the nodes that are not mentioned there that you think you need.

The docker installs each have their own package.json of course.

Installing all the dependencies on a new instance of node-red is as simple as ensuring that the package.json file is copied along with the flow file. Then a single command npm install does everything for you. This all happens in your userDir folder.

For docker, your userDir should be an external data container. But the same principle applies.

And don't forget that you are in command of an unbelievable amount of processing power. So just use some with a simple script that automates everything for you. You could do that with another utility instance of Node-RED if you really wanted to, but a script file would be easier. BASH on Linux and PowerShell or CMD file on Windows.

Well no need to post it because none of nodes i installed are listed there, not even on, but anyway here it is:
this is all it contains:
"name": "node-red-project",
"description": "A Node-RED Project",
"version": "0.0.1",
"private": true

Like I mentioned the package.json is dry and empty

Is that from a non-docker install? If so what do
ls -l ~/.node-red
ls -l ~/.node-red/node_modules
show when you are logged in as the user that runs node-red?

Also show us the node red startup log that you see when you start node-red in a terminal

here is the log when I run in terminal (note that node-red is already running hence the error relating to the address being in use):

13 Oct 01:26:50 - [info] 

Welcome to Node-RED

13 Oct 01:26:50 - [info] Node-RED version: v3.0.2
13 Oct 01:26:50 - [info] Node.js  version: v16.17.0
13 Oct 01:26:50 - [info] Linux 5.15.0-48-generic x64 LE
13 Oct 01:26:53 - [info] Loading palette nodes
13 Oct 01:26:57 - [info] Dashboard version 3.1.7 started at /ui
13 Oct 01:26:57 - [info] Settings file  : /home/autubuntu/.node-red/settings.js
13 Oct 01:26:57 - [info] Context store  : 'default' [module=memory]
13 Oct 01:26:57 - [info] User directory : /home/autubuntu/.node-red
13 Oct 01:26:57 - [warn] Projects disabled : editorTheme.projects.enabled=false
13 Oct 01:26:57 - [info] Flows file     : /home/autubuntu/.node-red/flows.json
13 Oct 01:26:57 - [info] Creating new flow file
13 Oct 01:26:57 - [warn] 

Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.

13 Oct 01:26:57 - [error] Uncaught Exception:
13 Oct 01:26:57 - [error] Error: listen EADDRINUSE: address already in use
    at Server.setupListenHandle [as _listen2] (node:net:1432:16)
    at listenInCluster (node:net:1480:12)
    at doListen (node:net:1629:7)
    at processTicksAndRejections (node:internal/process/task_queues:84:21)

and here is the listing result of the directories:
ls -l ~/.node-red

total 36
drwxrwxr-x 3 autubuntu autubuntu  4096 Oct 11 07:37 lib
drwxrwxr-x 2 autubuntu autubuntu  4096 Oct 11 07:37 node_modules
-rw-rw-r-- 1 autubuntu autubuntu   120 Oct 11 07:37 package.json
-rw-r--r-- 1 autubuntu autubuntu 22614 Oct 11 07:37 settings.js

ls -l ~/.node-red/node_modules

total 0

and yes I already Have nodes installed, which is odd.

Note that the log says that it is creating a new flows file, so the log you show us is not starting in the correct directory, unless you have not deployed any flows yet. So stop node red and then start again in a terminal and make sure it is opening the correct flows file.

If you installed node red using the Ubuntu/Debian/pi script then you can do that using

hi, thanks everyone for mentioning these notes, figured this out, the problem was that I used snap to install it and it had auto start the snap version by default when VM was turned on, and it was saving them in the snap
by going to the relative snaps directory found the files and backed up every thing needed

The problem was that I installed it using snap store, so I had to go to Node-Reds related snap directory to access it's files

thanks again

You would probably be better to use the recommended ubuntu install script.

yeah, had problems with installing node.js before, but used the correct way to install them in my new VM so no more problems

1 Like

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