Hello, yesterday I had a problem with the power supply and I have some corrupt files that prevent me from starting node-red. Before trying to solve this problem I would like to make a backup of my flow. Is it possible without booting the node-red?
I've tried node-red — safe but it doesn't work.
Work on a raspberry pi 4b with raspbian
Your flows should be in ~/.node-red/flows.json and your config settings in ~/.node-red/flows_cred.json.
In theory you could copy those two files to a new Node-red installation, but you would have to reinstall any non-standard nodes before it would work.
A more complete backup would include the whole ~/.node-red directory with the exception of the node_modules directory.
eg (not tested) tar cv --exclude=.node-red/node_modules -f noderedbackup.tar .node-red
To use this archive on a new installation, extract the backup archive, cd to .node-red and run npm install.
You can test this on a new SD card with no risk of overwriting your current (broken) installation.
I have searched for the described route but have not found my flows. I think this is going to be harder than I thought.
I have another rpi that works correctly. I have been able to locate the files in the previous post by @jbudd in home/***
But on the rpi that doesn't work I am not able to find the node-red folder.
I would appreciate some more help. I'm pasting a few lines of code, to see if someone can help me.
*****@raspberrypi:~ $ node-red
/usr/lib/node_modules/node-red/node_modules/ms/index.js:2
Copyright JS Foundation and other contributors, http://js.foundation
^^
SyntaxError: Unexpected identifier
at Object.compileFunction (node:vm:360:18)
at wrapSafe (node:internal/modules/cjs/loader:1126:15)
at Module._compile (node:internal/modules/cjs/loader:1162:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
at Module.load (node:internal/modules/cjs/loader:1076:32)
at Function.Module._load (node:internal/modules/cjs/loader:911:12)
at Module.require (node:internal/modules/cjs/loader:1100:19)
at require (node:internal/modules/cjs/helpers:119:18)
at Object.<anonymous> (/usr/lib/node_modules/node-red/node_modules/debug/src/debug.js:14:20)
at Module._compile (node:internal/modules/cjs/loader:1198:14)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.
I don't know what more information or code I should provide. I am a beginner raspberry OS user
Brilliant! It seems like I'm starting to have success.
I have managed to backup the entire folder where the configurations and flows are located. Could you help me repair/know what is the problem why node-red does not work?
If you have corrupted files you have no way of knowing exactly what has been corrupted. Start with a new card and recreate it from scratch. That way if you discover something else you need to recover you have a chance of it still being there on the old card. Always buy good quality cards from reputable suppliers, there are a lot of poor quality cheap clones out there.
It may be ok to later re-use the old card but it might be safer just to chuck it.