I've got myself into a bit of a bind. Node-Red won't start and instead displays a repeating error message:
[error] [ui_guage: a long number] TypeError: Cannot read property.
I assume that this is caused by a fault in the flow that I was was playing with when Node-Red crashed and further I expect that if I delete the errant file from .node-red then the problem will be solved.
The question is, which file?
I did start node-red in safe mode and I did rename .node-red thinking that Node_red would recreate a new directory, but it didn't and the problem persists.
I'm very much a beginner with Node-Red and initially had some success with basic stuff. I don't know exactly how the problem came about, all I know is that Node-red won't start.
The long number that I referred to is, I guess, the id of the flow or the gauge.
Starting in safe mode doesn't appear to list any faulty nodes or flows. Perhaps I should send a screen grab in my next reply?
[info] Flows stopped in safemode. Deploy to start.
There are two files in .node-red that might contain the errant flow. flows_raspberrypi.json and a backup file. I tried using leaf pad the read them but it refuses to cooperate.
What OS are you running and how did you install node red?
In a terminal, stop node red then restart it and copy/paste the result here (not screenshot if possible please). When pasting it in use the </> button at the top of the forum entry window.
I'm using Raspberry OS and I installed Node-Red using the script from the Node-Red site. All worked well for two days. I was weeding out flows that I'd saved when Node-Red crashed. It appears that the last flow is the culprit. Now Node-Red won't start.
I've packed the lot away now but I will do as you suggest in the morning.
Though it would be good to find why it is crashing before you fix it. If node-red is actually crashing then that indicates a bug which should be fixed.
That's precisely the problem. Safe mode doesn't appear to indicate which node is causing the problem. I'll post the result of a normal and a safe start in a reply to Colin's post.
I knew that the gauge was the problem but I couldn't get Node-Red to start and I cannot see how to delete the faulty flow so that Node-Red would start. Anyway, it's all good now which brings me to another question.
Is there a way to delete Flow 1, for instance? I simply delete nodes that I haven't set up correctly and then exit Node-Red.
My method of saving flows may not be efficient. I export the flow which ends up in my downloads directory. I then rename Flow1.json. Can't I just rename Flow 1 and then save it?
You do not have to deal with files/directories.
To delete a complete flow, doubleclick on the 'Flow 1' tab and click delete, then click deploy and the flow is saved.
I find that saving a flow is a little confusing and I'm never sure that a flow has been save or where it's been saved. I've been using the export flow menu item and then renaming the saved "Flows.json" file. If I'm using Node-Red from the Raspberry Pi terminal then the flows are saved in my downloads directory as "Flows.json" even if I rename the flow before exporting the flow. I cannot find a setting to change the saved directory.
I've found that I cannot delete a flow if it's the only one. If there are two flows shown then I can delete either one.
I have sought answers from the extensive documentation and I'm not a big fan of video tutorials because there's often a lot of mouse clicking and screens that are barely readable. However, I'll see where the link that you've provided leads me.
Having selected Export are you then clicking Download? By doing that you are telling node-red to download the file to the machine running the browser (which may or may not be the machine running node-red). Where the browser saves it to is up to the browser, node-red cannot tell the browser where to save it. If you want to change where it downloads to then you need to find how to do that in your browser settings.
Why do you want to save a flow? What are you going to do with it after saving it?
That is because if you deleted that flow there would be nothing on which to lay new nodes down. You must always have one flow open even if it has no nodes on it. I believe that if you want to empty the flow then if you select a node and then click Ctrl-A it will select all the nodes in that flow and then you can click Delete.
Regarding the download directory, I did notice that the default save directory on the Raspberry Pi is "downloads" whereas on the laptop (not where Node-Red is installed) I can select the save-to directory. It all makes sense now.
The reason that I want to save flows is so that I can refer to them later. You're the second person to have asked the same question. This makes me think that I'm missing something here. I have a directory of Python scripts and a C++ directory as well. It seems logical to have a Node-Red directory of saved flows.
Deleting a flow was really the wrong term to use, I was thinking of a quicker method to empty a flow. I discovered ctl a in the documentation.
Have you seen the Export to library feature? That does some of what you want, exporting the selected nodes or flow to a named file in a subfolder of .node-red/lib.
If that is not sufficient then perhaps an extension to that to allow export to a chosen folder anywhere on the server is what you want. Along with a similar extension to the Import feature.
I have seen the "export to library" option but it didn't sound like something that I needed. I will investigate it. Export to a chosen directory would be ideal although export to my download directory is OK for now.
Note that there is a big conceptual difference here. Export to library exports to a file on the node-red server. Export and Download sends it to the browser which saves it on the machine running running the browser, which may be a different machine. For example you might be running node-red on a Pi and using a PC to run the editor and view the dashboard in a browser. In that case Export to library saves it on the pi, Export/Download saves it on the laptop.
Thank yet again Colin, I now understand the difference.
I had been transferring flow files between my Raspberry Pi and my laptop to keep the files on the one machine. I'll sort this out the next time I have my Raspberry Pi out to play with.