vinyl-ftp: No such file or directory when using conn.clean()

230 Views Asked by At

I am using vinyl-ftp to deploy an Angular App to my FTP Server.

I use the following gulp task:

gulp.task('deploy:dev', function () {
  const connection = ftp.create({
    host: 'host.com',
    user: 'user',
    password: 'pw',
    log: gutil.log,
    parallel: 1,
    reload: true
  });

  const remotePath = '/remote';

  return gulp.src(['dist/**', '!dist/.htaccess'], { buffer: false })
    .pipe(connection.newer(remotePath))
    .pipe(connection.dest(remotePath))
    .pipe(connection.clean(remotePath + '/**', 'dist/**'));
});

I get the following error when using conn.clean():

[08:54:03] Starting 'deploy:dev'...
[08:54:03] CONN
[08:54:03] READY
[08:54:03] MLSD  /remote
[08:54:04] MLSD  /
[08:54:04] LIST  /remote
[08:54:04] LIST  /
[08:54:04] MLSD  /remote/assets
[08:54:04] DEL   \remote\3rdpartylicenses.txt
[08:54:04] LIST  /remote/assets
[08:54:04] 'deploy:dev' errored after 864 ms
[08:54:04] Error: \remote\3rdpartylicenses.txt: No such file or directory
    at makeError (C:\Users\volkende\WebstormProjects\project\node_modules\ftp\lib\connection.js:1067:13)
    at Parser.<anonymous> (C:\Users\volkende\WebstormProjects\project\node_modules\ftp\lib\connection.js:113:25)
    at emitTwo (events.js:106:13)
    at Parser.emit (events.js:191:7)
    at Parser._write (C:\Users\volkende\WebstormProjects\project\node_modules\ftp\lib\parser.js:59:10)
    at doWrite (_stream_writable.js:331:12)
    at writeOrBuffer (_stream_writable.js:317:5)
    at Parser.Writable.write (_stream_writable.js:243:11)
    at Socket.ondata (C:\Users\volkende\WebstormProjects\project\node_modules\ftp\lib\connection.js:273:20)
    at emitOne (events.js:96:13)

Info & Question

  • The same error occurs for all files, not just 3rdpartylicenses.txt (also for files with hash such as inline.da6sadja7sdj9.bundle.js)

  • I noticed the switching between / and \. I am using a Windows machine at the moment, the FTP server uses /

  • Why does conn.clean() throw such an error, because the files are there when I manually check the remote location

0

There are 0 best solutions below