[英]Error: write EPIPE when trying to upload file to FTP using gulp
I've got a task to deploy some stylesheets out to a server using FTP and about 80% of the time I get this error, 我有一项任务是使用FTP将一些样式表部署到服务器上,大约80%的时间出现此错误,
Error: write EPIPE
at _errnoException (util.js:1022:11)
at WriteWrap.afterWrite [as oncomplete] (net.js:880:14)
I'm using vinyl-ftp to upload the file as seen in the code here, 我正在使用Vinyl-ftp上传文件,如此处的代码所示,
var conn = ftp.create({
host: 'host',
user: 'user',
password: 'pass',
parallel: 10,
idleTimeout: 10000,
reload: true,
secure: true,
secureOptions: {rejectUnauthorized: false},
log: gutil.log
});
// What files to transfer over (can be used in case there are more files to be uploaded in the future)
var globs = [
localDir + '/' + jobName + 'Default.css'
];
gutil.log("Local File: " + globs[0]);
var remoteDir = '/' + environment + '/css/' + clientName + '/' + jobName;
gutil.log("Remote Dir: " + remoteDir);
return gulp.src(globs, {buffer: false}).pipe(conn.dest(remoteDir));
The server that I'm uploading to is using FTP-SSL (Explicit AUTH TLS). 我要上传到的服务器正在使用FTP-SSL(显式AUTH TLS)。 I'm not sure if that's what's causing the issue but I've tried catching the error and adding an onerror event to process.stdout but none of them work.
我不确定这是否是导致问题的原因,但是我尝试捕获错误并在process.stdout中添加onerror事件,但是它们都不起作用。 When the error does trip it uploads an empty file to my server.
当错误确实触发时,它将一个空文件上传到我的服务器。
It'd be great to find a solution to this or better yet a different FTP package. 很高兴找到一个解决方案,或者更好的FTP软件包。
Edit 1: I'm on Windows. 编辑1:我在Windows上。
您可以使用SSH连接https://www.tecmint.com/rsync-local-remote-file-synchronization-commands/将rsync用于同步本地和服务器
Finally just said screw it and changed what module I was using. 最后,只需说出螺丝钉,然后更改我正在使用的模块。 node-ftp only throws the EPIPE error about 5% of the time compared to the original 80%.
与原始80%的时间相比, node-ftp仅将5%的时间抛出EPIPE错误。 You can also catch the error which is useful because I catch it and try to upload the file again.
您也可以捕获到有用的错误,因为我捕获了该错误并尝试再次上传该文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.