Error: read ECONNRESET after application exit

Viewed 1824

This question is specific to React Native Expo.

I get:

[09:50:39] events.js:167
[09:50:39]       throw er; // Unhandled 'error' event
[09:50:39]       ^
[09:50:39]
[09:50:39] Error: read ECONNRESET
[09:50:39]     at TCP.onStreamRead (internal/stream_base_commons.js:139:27)
[09:50:39] Emitted 'error' event at:
[09:50:39]     at emitErrorNT (internal/streams/destroy.js:82:8)
[09:50:39]     at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
[09:50:39]     at process.internalTickCallback (internal/process/next_tick.js:72:19)

The server crashes. This occurs a short time after exiting the app using the back button. Initially, I thought this was related to an audio stream that was played, but later I wrote a simple Hello World app and that produced the same result after exiting using the back button.

Is this the usual behavior, or could this be a side effect from the ESET firewall?

1 Answers

Definitely not usual behaviour, and not sure if related to ESET firewall but a pretty common error. Lots of discussion here on this expo-cli's github issue and potential fixes.

Exact cause hasn't been pinpointed but someone suggested that this seems to occur on Node v10, so if you have a node version manager (using n) and switch to v8 while working with react native expo, it could rid you of this error.

$ npm install -g n
$ n 8.16

// verify node version
$ node -v

(don't input $, this is in terminal, I'm on macOS)

Lots of people seem to experience this error, but not necessarily on app close, like me. For me on a good day, expo server might crash 1-5 times, or on a bad day, every 5-10 minutes. Super annoying.

Now I just switch to node v8.16 while working with react native expo and it's rock solid.

Related