Node-red upgrade delete flow file

I just upgraded node-red to the newest version and now my flow files are gone.

I desperately need to get them back. They are not in the .node-red directory.

Upon further review it completely replaced everything. Even all of the installed modules are missing

it is more likely you are running as root or different user to what it usually runs.

Unless you purposefully deleted .node-red folder.

Yes, you are right. Somehow it changed the systemd service to point to my personal user account. I have modified the nodered.service file to point to the correct location but it continues to try and load the flow file from my personal dir. Does version 2.x of NR get the systemd directives from a place other than /usr/lib/systemd/system?

Did you run the pi/Ubuntu/Debian upgrade script to update node-red? If so then you should do that as the user that will run node-red. If you did it as the wrong user then login as the correct user and run it again and that should sort it out.

You said you desperately wanted to get the flows back, which I presume means that you have not backed them up, so do that before doing anything else.

they were backed up 3 days ago. I did find the flow files. I did another backup. I will try running the update from the user where the files are located. Thanks

That did the trick.

One other question, It was recommended to me to install node-red in a dir that is not associated with a user. This way if the suer account was ever deleted the node-red would not be lost.

Using this logic, if correct, how would it be made to happen?

Under Linux, every directory and file is associated with a user.

Considering root, yes, I agree. But can we cannot install it in /usr/lib or something like that?

Who recommended that?

A guy that I consider one of the top NR developers and a contributor to NR dev.

Node red itself is globally installed into the system area. If he meant the .node-red folder then ask him where exactly he would put it and how he would do the install. I wonder whether you misunderstood what he meant.

Yes, sorry. He referred to the node-red folder.

I will check in with him when he gets back. He is currently on holiday.

I can see this could be done, and why it might be a good idea. It would be possible, for example, to create a folder /var/lib/node-red owned by a user without login access (say user node-red) and put the flows, settings, etc there, and adjust the startup script to use those files. It would not be so easy if you had to manually install nodes though as you could not login as that user.

Other applications do exactly this (influxdb for example), but they don't have the requirement to manually run npm.