firebase-tools: 8.4.3
Platform: Windows
Nodejs version: 10.16.0
Terminal: Hyper
I get this error when I run more than one export with an instance of firestore emulator running.
See this screen capture for more details :

1) Run the firestore emulator :
firebase emulators:export ./data
2) Run a first export :
firebase emulators:export ./data
The export should be work fine.
3) Run an another export :
firebase emulators:export ./data
This export throw an error.
I want made more than one export.
When I try to open the firebase-debug.log file, I get an error.

I think the trouble is due to the logging which is lock by one of the two command. When I run the second export the logger can't write into the firebase-debug.log.
I seem to have the same issue. This happens to me when I export data for the second time.
On my MacBook I was not able to reproduce this which leads me to believe it's a Windows specific issue. I'll have to find some time to test this on my personal Windows laptop.
I was able to reproduce this on Windows. Note that it happens on the second export even if the export directory is deleted in between, so it's not just a problem with the overwrite (which was my initial hunch)
@abeisgoat this error actually comes from our Winston logger, do you have any ideas? It's really easy to reproduce, just run emulators:export twice on Windows
Same error (Windows 10).
This is quite frustrated because even though we can exit the emulator (Ctrl+C) and run again, the previously tested data has no longer there, nothing to export anymore, we need to redo all the data entries again. @_@
I'm also getting this. The 1st export worked just fine. Trying to do another one and I'm getting this error.
firebase emulators:export emulatorData
C:\Users\USER\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\lib\winston\logger.js:307
throw ex;
^
Error: write after end
at writeAfterEnd (C:\Users\USER\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\node_modules\readable-stream\lib\_stream_writable.js:261:12)
Exact same issue here. Its quite a husle losing all the test data like that. Hopefully it's fixed soon
OK so I worked around it, but I don't necessarily recommnend it.
I went to the C:\Users\USER\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\lib\winston\logger.js in line 307 and commented out the throw ex; to avoid the runtime from stopping there. I also added console.log(ex); just so I still see the error details in the console.
My main goal was not to lose my test data on that session, so not sure about side effects.
Also managed to import that data back with no apparent issues. On the surface it seems to be a problem with winstonjs logger
Hopefully a fix is on the way
On the surface it seems to be a problem with winstonjs logger
Yes, as @samtstern 's feedback here, it is.
Has anyone tried this with 8.7.0 and see if it still fails? I am wondering if https://github.com/firebase/firebase-tools/issues/2464 helped at all, even though it was a fix for a different issue.
@samtstern : Yes, tested with 8.7.0, problem solved!
@andirayo thank you for confirming it's fixed! That's great news, since I really had no good ideas on how to solve this problem haha.