Node.js - events.js:154 throw err write EPIPE;程序崩溃
Node.js - events.js:154 throw err write EPIPE; Program Crashing
正在尝试运行我的Node.js程序,已经运行了很长时间,现在突然...不行了。我正在尝试找出问题所在,并且我认为如果我在这里发布以尝试追踪它会有所帮助。这是日志输出:
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 错误,我检查过没有任何 运行ning 会干扰它 运行ning 在完全相同的 shell 和以前一样。如果有什么我应该补充的让我知道。
引用 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.
当另一端终止连接时,Steam 可能是 pipe
或 socket
。这是一个 运行 次错误;除了结束你的结局之外,你无能为力。
请检查你的程序中是否有大文件写入或长http包请求。
在这种情况下使用下面的代码可以使您的程序成功退出:
process.stdout.on('error', function( err ) {
if (err.code == "EPIPE") {
process.exit(0);
}
});
在我的例子中,问题在于 question
中讨论的 inotify 观察者数量
这里是 original listen documentation
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
安装 libfontconfig 可能会解决问题。我在尝试从服务器下载 PDF 时遇到了同样的问题。 libfontconfig 解决了这个问题。
sudo apt-get install libfontconfig
注:解决方案来源 -> Error: write EPIPE
正在尝试运行我的Node.js程序,已经运行了很长时间,现在突然...不行了。我正在尝试找出问题所在,并且我认为如果我在这里发布以尝试追踪它会有所帮助。这是日志输出:
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 错误,我检查过没有任何 运行ning 会干扰它 运行ning 在完全相同的 shell 和以前一样。如果有什么我应该补充的让我知道。
引用 doc
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 可能是 pipe
或 socket
。这是一个 运行 次错误;除了结束你的结局之外,你无能为力。
请检查你的程序中是否有大文件写入或长http包请求。
在这种情况下使用下面的代码可以使您的程序成功退出:
process.stdout.on('error', function( err ) {
if (err.code == "EPIPE") {
process.exit(0);
}
});
在我的例子中,问题在于 question
中讨论的 inotify 观察者数量这里是 original listen documentation
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
安装 libfontconfig 可能会解决问题。我在尝试从服务器下载 PDF 时遇到了同样的问题。 libfontconfig 解决了这个问题。
sudo apt-get install libfontconfig
注:解决方案来源 -> Error: write EPIPE