Hello to all,
I'm not able access node-red via browser due to my context storage error. Below error
shown when running node-red from cli.
"$ node-red start
10 Dec 15:04:53 - [info]
Welcome to Node-RED
10 Dec 15:04:53 - [info] Node-RED version: v2.1.1
10 Dec 15:04:53 - [info] Node.js version: v14.18.1
10 Dec 15:04:53 - [info] Linux 3.4.39 arm LE
10 Dec 15:04:54 - [info] Loading palette nodes
10 Dec 15:04:58 - [info] Dashboard version 3.0.4 started at /ui
10 Dec 15:04:58 - [info] Settings file : /home/htnice/.node-red/settings.js
10 Dec 15:04:58 - [info] Context store : 'memoryOnly' [module=memory]
10 Dec 15:04:58 - [info] Context store : 'file' [module=localfilesystem]
10 Dec 15:04:58 - [error] Failed to start server:
10 Dec 15:04:58 - [error] Error: Error loading context store: Error: Invalid JSON in context file '/home/htnice/.node-red/context/e9667f131763216a/flow.json'
at /usr/local/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/context/index.js:175:15
$
"
How do i revert back to last good condition stage?
Appreciate anyone can help.
Thank you
If you have not installed using the recommended Ubuntu/Debian/Pi script then the command to start node red using the default flow file is node-red
Adding start tells it to use a flow file called start.
Assuming it still fails using node-red then delete the file it is complaining about, which appears to be corrupted. Did you have a power failure? That is the sort of situation that might cause the corruption. The file contains flow context data.
In fact rather than delete, move it somewhere and see what is in it. Restart node red after moving it.
The error in the log tells you exactly what the issue is.
You have file context enabled, and somehow one of the store files has invalid JSON in it.
Have a look at the json file mentioned in the error message.
The quick fix will be to remove that file - you will lose whatever context data had been saved for that flow, but if the file is bad, then it's probably already lost.
Does the fact that you have marked this as the solution mean that you do not need the question there answered?
Just in case, you should backup the whole of the .node-red folder except for the node_modules folder, which may be very large.
The fact that you lost more than just the context file is worrying. In your situation I would probably discard the SD card, or at least only use it on non-critical systems, as there is a possibility that it may be failing. Also make sure you are using a good quality power supply.
If you did use node-red start as originally posted you may well also have a file called start or start.json that may contain a version of your flows - whether it is worth saving will require some careful digging - but first backup the files as Colin suggested.
Hello UnborN,
I setup systmectl enable node-red.service to startup my node-red application when controller is power up. By default it will run flows.json.
Here is my json files. Unfortunately i already deleted that corrupt flows.json and flows.json.backup which on date 09 Dec. The rest of json files still in good condition.
Why did you delete the actual flow files? Nobody suggested to do that.
The discussion and suggestions was to backup the .node-red folder
and then remove the Context file '/home/htnice/.node-red/context/e9667f131763216a/flow.json'
Anyway .. i think the only chance to salvage anything is from that flows.json.bak1 file with Date Nov 5
Open it with a text editor .. copy its contents and paste in the Node-red Editor Import window (Ctrl-I)