2

我的任务是使用 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)。我不确定这是否是导致问题的原因,但我尝试捕获错误并将 onerror 事件添加到 process.stdout 但它们都不起作用。当错误确实发生时,它会将一个空文件上传到我的服务器。

很高兴找到一个解决方案或更好的不同 FTP 包。

编辑 1:我在 Windows 上。

4

1 回答 1

0

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%. You can also catch the error which is useful because I catch it and try to upload the file again.

于 2018-06-28T19:15:17.250 回答