morris / vinyl-ftp

Blazing fast vinyl adapter for FTP
Other
388 stars 31 forks source link

gulp 4 vinyl-ftp Unable to make data connection #121

Open miojamo opened 5 years ago

miojamo commented 5 years ago

I'm facing problem with uploading files, randomly it stops with different kind of errors: Unable to make data connection at Socket. (/aaa/node_modules/ftp/lib/connection.js:935:10) or Error: Client aborted. Sometimes it works when launched e.g. 10 times

gulp -v CLI version 2.0.1 Local version 4.0.0

vinly-ftp: 3.5.2

Gulp JS:

var deployPaths =
{
    'aaa/public_html': [],
    'bbb/public_html': [],
};

var defaultTasks = [];

function deployMultiple(key) {

    var conn = ftp.create({
        host: 'site',
        user: 'xxxx',
        password: 'xxxxxx',
        parallel: 10,
        maxConnections: 5,
        log: plugins.util.log
    });

    var globs = [

        path + '/some_path/**',
        '!' + path + '/some_path/aa/**',
        '!' + path + '/some_path/bb/**',
        path + '/administrator/some_path/**',

    ];

    // using base = '.' will transfer everything to /public_html correctly
    // turn off buffering in gulp.src for best performance
    return gulp.src(globs, {base: path, buffer: false})
        .pipe(conn.newer(key)) // only upload newer files
        .pipe(conn.dest(key));

}

gulp.task('deploy-task', function (cb) {
    for (var key in deployPaths) {
        deployMultiple(key);
        cb();
    }

});

gulp.task('deploy',gulp.series('clean','git_export','deploy-task'));
ifeiwu commented 5 years ago

add options:

ftp.create({ reload: true });

miojamo commented 5 years ago

Still does not work:

      throw er; // Unhandled 'error' event
      ^
Error: Unable to make data connection
    at Socket.<anonymous> (/home/xxx/node_modules/ftp/lib/connection.js:935:10)
    at Socket.g (events.js:260:16)
    at emitOne (events.js:82:20)
    at Socket.emit (events.js:169:7)
    at TCP._onclose (net.js:469:12)
Spomsoree commented 1 year ago

Same issue, gulp 4 no success connecting to the server.