我正在使用vinyl-ftp将Angular App部署到我的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)
信息&amp;问题
所有文件都会出现同样的错误,而不仅仅是3rdpartylicenses.txt
(也适用于带有散列的文件,例如inline.da6sadja7sdj9.bundle.js
)
我注意到/
和\
之间的转换。我目前正在使用Windows机器,FTP服务器使用/
为什么conn.clean()
会抛出这样的错误,因为当我手动检查远程位置时文件就在那里