Vinyl-ftp strange error

泄露秘密 提交于 2019-12-23 03:36:37

问题


I am using Vinyl-ftp to do deployment, when i try to connect with FileZilla or Total Commander everything works ok, but when i try wirh Gulp task i got strange error, i dont see the difference, here is my Gulp task and error message

gulp.task('ftp-test-connection', function () {


var conn = ftp.create({
    host: 'hostname',
    user: 'user',
    password: 'password',
    parallel: 10,
    log: gutil.log
});

var globs = [
      './styles/**/*{css,png,jpg,gif,ttf,woff,eof,svg,woff2}',
      './images/**',
      './views/**',
      './scripts/vendor.scripts.min.js',
      './dist/index.html',
      './dist_test/main.scripts.min.js',
      './dist_test/web.config'
];

return gulp.src(globs, { base: '.', buffer: false })
    .pipe(gulpIf('dist/index.html', rename({ dirname: '' })))
    .pipe(gulpIf('dist/web.config', rename({ dirname: '' })))
    .pipe(gulpIf('dist_test/main.scripts.min.js', rename({ dirname: '/scripts' })))
    .pipe(conn.newer('/site/wwwroot'))
    .pipe(conn.dest('/site/wwwroot'));

});

And here is my error **

[11:31:59] ERROR Error: User cannot log in.
    at makeError (C:\node_modules\vinyl-ftp\node_modules\ftp\lib\connection.js:1067:13)
    at Parser.<anonymous> (C:\node_modules\vinyl-ftp\node_modules\ftp\lib\connection.js:113:25)
    at emitTwo (events.js:87:13)
    at Parser.emit (events.js:172:7)
    at Parser._write (C:\node_modules\vinyl-ftp\node_modules\ftp\lib\parser.js:59:10)
    at doWrite (_stream_writable.js:292:12)
    at writeOrBuffer (_stream_writable.js:278:5)
    at Parser.Writable.write (_stream_writable.js:207:11)
    at Socket.ondata (C:\node_modules\vinyl-ftp\node_modules\ftp\lib\connection.js:273:20)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:146:16)
    at Socket.Readable.push (_stream_readable.js:110:10)
    at TCP.onread (net.js:523:20) (530)
Process terminated with code 1.

**


回答1:


I faced the same issue with "vinyl-gulp" and Azure App Services (a.k.a. Azure Web Sites).

In my case the problem was caused by the "\" character contained on the Azure FTP username. I just had to double the "\" (ex: "someuser\$someuser") to solve the issue.

I hope it helps...

M.



来源:https://stackoverflow.com/questions/39246337/vinyl-ftp-strange-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!