Node.js - events.js:154 throw err write EPIPE; Program Crashing

三世轮回 提交于 2019-11-29 08:13:55

Quoting doc

EPIPE: A write on a pipe, socket, or FIFO for which there is no process to read the data. Commonly encountered at the net and http layers, indicative that the remote side of the stream being written to has been closed.

The steam maybe a pipe or socket when the other end has terminated the connection. It's a run-time error; there is nothing you can do but close your end as well.

Please check if there is one big file written or long http package request in your program.

With the following code could make your program exit successfully in this case:

process.stdout.on('error', function( err ) {
    if (err.code == "EPIPE") {
        process.exit(0);
    }
});
M Chambers

In my case, the issue was with the number of inotify watchers as discussed in this question

And here is the original listen documentation

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!