1

我正在使用乙烯基 ftp将 Angular 应用程序部署到我的 FTP 服务器。

我使用以下 gulp 任务:

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/**'));
});

使用时出现以下错误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)

信息和问题

  • 所有文件都会发生相同的错误,而不仅仅是3rdpartylicenses.txt(也适用于具有哈希值的文件,例如inline.da6sadja7sdj9.bundle.js

  • /我注意到和之间的切换\。我现在使用的是 Windows 机器,FTP 服务器使用/

  • 为什么会conn.clean()抛出这样的错误,因为我手动检查远程位置时文件在那里

4

0 回答 0