Error: write EPIPE when trying to upload file to FTP using gulp
Error: write EPIPE when trying to upload file to FTP using gulp
我有一项任务是使用 FTP 将一些样式表部署到服务器,大约 80% 的时间我都会收到此错误,
Error: write EPIPE
at _errnoException (util.js:1022:11)
at WriteWrap.afterWrite [as oncomplete] (net.js:880:14)
我正在使用 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));
我要上传到的服务器正在使用 FTP-SSL(显式 AUTH TLS)。我不确定这是否是导致问题的原因,但我尝试捕获错误并向 process.stdout 添加一个 onerror 事件,但其中 none 有效。当错误确实发生时,它会向我的服务器上传一个空文件。
如果能找到解决此问题的方法或更好的不同 FTP 包,那就太好了。
编辑 1: 我在 Windows。
最后只是说拧紧它并更改我使用的模块。 node-ftp 与原来的 80% 相比,只有大约 5% 的时间抛出 EPIPE 错误。您还可以捕获有用的错误,因为我捕获了它并尝试再次上传文件。
我有一项任务是使用 FTP 将一些样式表部署到服务器,大约 80% 的时间我都会收到此错误,
Error: write EPIPE
at _errnoException (util.js:1022:11)
at WriteWrap.afterWrite [as oncomplete] (net.js:880:14)
我正在使用 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));
我要上传到的服务器正在使用 FTP-SSL(显式 AUTH TLS)。我不确定这是否是导致问题的原因,但我尝试捕获错误并向 process.stdout 添加一个 onerror 事件,但其中 none 有效。当错误确实发生时,它会向我的服务器上传一个空文件。
如果能找到解决此问题的方法或更好的不同 FTP 包,那就太好了。
编辑 1: 我在 Windows。
最后只是说拧紧它并更改我使用的模块。 node-ftp 与原来的 80% 相比,只有大约 5% 的时间抛出 EPIPE 错误。您还可以捕获有用的错误,因为我捕获了它并尝试再次上传文件。