Node.js - events.js:154 throw err写EPIPE;程序崩溃 [英] Node.js - events.js:154 throw err write EPIPE; Program Crashing
问题描述
尝试运行我已经工作了很长时间的Node.js程序,现在却突然......不行。我正在试图弄清楚问题,我认为如果我在这里发布以试图追踪它会有所帮助。这是日志输出:
Trying to run my Node.js program, which has worked for a long time, and now it is suddenly... not. I'm trying to figure out the problem, and I figured it would be helpful if I posted here to try to track it down. Here's the log output:
events.js:154
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at exports._errnoException (util.js:856:11)
at WriteWrap.afterWrite (net.js:767:14)
坦率地说,我不知道为什么它会抛出EPIPE错误,我已经检查过没有什么可以干扰的运行,并且它运行在与之前完全相同的shell中。如果有什么我应该添加让我知道。
Quite frankly I have no clue why it's throwing an EPIPE error, I've checked that there's nothing running that could interfere and it's running in the exact same shell as it has before. If there's anything I should add let me know.
推荐答案
引用 doc
EPIPE
:在管道,套接字或FIFO上写入,没有进程读取数据。通常在net
和http
图层中遇到,表示正在写入的流的远程端已关闭。
EPIPE
: A write on a pipe, socket, or FIFO for which there is no process to read the data. Commonly encountered at thenet
andhttp
layers, indicative that the remote side of the stream being written to has been closed.
Steam可能是管道
或 socket
当另一端终止连接时。这是一个运行时错误;没有什么可以做,但也关闭你的目的。
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.
请检查程序中是否有大文件或长 http包请求。
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);
}
});
这篇关于Node.js - events.js:154 throw err写EPIPE;程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!