Multiple inputs to save into a file! failed to write to file: Error: write after end

Hello, I am saving the output of a python script that I am running on node-RED into a local file. Because the output is too long (I am guessing), it comes in two message.payload right next to the other. I want to save them both into a local file and when I put a save file node after the python script , I get this error:

failed to write to file: Error: write after end

I am aware of this post https://github.com/node-red/node-red/pull/1894 and I understand now what the problem is, but I don't know how to fix it. I don't understand how to download/implement the solution in this post. I can't find anything. Does anyone have a different solution or can tell me how to implement this one? Thanks.

If you read that PR, you will see it was merged into the code in the v0.19.5 release of NR so if you are on v0.19.5 or later, this is already in the code.

When posting an issue it is helpful to provide

  1. version on node-red
  2. version of node.js
  3. platform you are using and OS version (like Raspberry Pi running stretch lite)
  4. a simplified copy of your flow demonstrating the issue.
    Doing this will save time for people who might decide to help you.

Okay, thanks. I did read the PR but I do not understand these words. You are right, I have a version v0.19.4 . Is the only solution to install Node-RED from the start? I already have a big flow that is working. Am I gonna lose everything?

You can upgrade Node-RED without losing any of your data.

How did you install node-red originally?

But if you have a big flow you probably should be taking backups anyway.

It’s easy enough to copy the flow file to another location or to use the node-red projects feature.

I just followed the documentation in the Raspberry Pi website to install Raspbian and Node-RED came with it if I remember correctly. I didn't have to install it separately.
https://www.raspberrypi.org/documentation/installation/installing-images/

Hello. That would be very helpful so that at least it's safe even if I mess something up while upgrading. How can I do that?

Node-RED reports where the flows file is on startup. How to copy that to a new location? Copying a file is hopefully something you already know how to do.

The projects feature? See the docs on the node-red website.

The Pi docs on nodered.org give you a script we provide to install/update NR.

1 Like