Ошибка в gulp with vinyl-ftp: извините, сеансы открытого текста не принимаются на этом сервере

Я сталкиваюсь с проблемой при загрузке и обновлении файлов на FTP-сервере, используя винил-ftp в gulp.

Мой код gulpfile.js:

var gutil = require('gulp-util');
var ftp = require('vinyl-ftp');

gulp.task( 'deploy-dev', function () {

    var conn = ftp.create( {
        host:     'my_server_host_name',
        user:     'my_server_username',
        password: 'my_server_password',
        parallel: 5,
        log:      gutil.log
    } );

    var globs = [
        'assets/**',
        '!node_modules/**',
        '!assets/img/**',
        '!assets/bower_componets/**',
        '!assets/dist/**'
    ];

    // using base = '.' will transfer everything to /public_html correctly 
    // turn off buffering in gulp.src for best performance 

    return gulp.src( globs, { base: 'assets/', buffer: false } )
        .pipe( conn.newer( '/public_html/demos/P-09-Sakha/html' ) ) // only upload newer files 
        .pipe( conn.dest( '/public_html/demos/P-09-Sakha/html' ) );

} );

// Default Task
gulp.task('default', [ 'scripts','css','watch', 'deploy-dev']);

И в моем терминале я вижу следующую ошибку:

[16:58:12] Using gulpfile E:\xamp\htdocs\projects\P-09-sakha\html\gulpfile.js
[16:58:12] Starting 'scripts'...
[16:58:12] Starting 'css'...
[16:58:12] Starting 'watch'...
[16:58:12] Finished 'watch' after 74 ms
[16:58:12] Starting 'deploy-dev'...
[16:58:12] CONN
[16:58:12] CONN
[16:58:14] ERROR Error: Sorry, cleartext sessions are not accepted on this serve
r.
    at makeError (E:\xamp\htdocs\projects\P-09-sakha\html\node_modules\vinyl-ftp
\node_modules\ftp\lib\connection.js:1067:13)
    at Parser.<anonymous> (E:\xamp\htdocs\projects\P-09-sakha\html\node_modules\
vinyl-ftp\node_modules\ftp\lib\connection.js:113:25)

Я был бы очень признателен, если кто-нибудь может мне помочь в этом отношении.

1 ответ

Решение

Попробуйте установить параметры secure а также secureOptions:

var conn = ftp.create( {
    host:     'my_server_host_name',
    user:     'my_server_username',
    password: 'my_server_password',
    parallel: 5,
    log:      gutil.log,
    secure:   true,
    secureOptions: {
      rejectUnauthorized: false
    }
} );
Другие вопросы по тегам