问题
I have succesfully installed nodered on my raspberry-pi.But the problem is each time i write a flow,i have to save the flow into flows_raspberrypi.json and restart nodered server. How to make it automatically save the nodes.
回答1:
2 possible things.
1) If you created there flow file by hand then you probably need to create a file called flows_raspberrypi_creds.json containing:
{}
2) assuming no errors in either the flow file or the creds file then node-red will load a file based on the machines hostname to start with, you can override this by passing a name on the command line:
$node red bob
will load bob.json & bob_creds.json
If neither of those work run node red -v
to show more detailed error messages.
回答2:
I had the same problem, eventually figured out that node-red was loading my flows from:
/home/pi/.node-red/
This is supposed to be controlled by the settings.js file in your main node-red directory. Although mine was commented out, which is supposed to then load the flows from the main install directory.
To fix mine I edited my settings.js located in the node-red main install folder by changing this:
//userDir: '/home/nol/.node-red/',
to this:
userDir: '/home/pi/.node-red/',
It looks like a fault with node-red to me, will have a quick look when I get chance to see if I can see the code in their Git repository causing the problem. If I can't figure it out I will raise an issue.
Your username could be different to my default pi one, if so just change the line above to reflect your username.
Also delete any files that are in your /home/pi/.node-red/ folder. I had:
.config.json
.flows_raspberrypi.json
flows_raspberrypi.json
Until these were deleted and node-red restarted I got node not deployed errors and other strange problems.
Hopefully this will fix it for you like it did for me.
来源:https://stackoverflow.com/questions/26092794/node-red-not-automatically-loading-flows