jerrysu / gulp-rsync

Gulp plugin for deploying files via rsync
119 stars 51 forks source link

Error: spawn E2BIG #23

Open tnguyen14 opened 9 years ago

tnguyen14 commented 9 years ago

I am not sure why I am running into this error, I have not seen them before with this module.

[23:06:48] Starting 'deploy'...
[23:06:51] gulp-rsync: Starting rsync to tri@myserver.com:/path/to/server/directory...
internal/child_process.js:297
    throw errnoException(err, 'spawn');
          ^
Error: spawn E2BIG
    at exports._errnoException (util.js:846:11)
    at ChildProcess.spawn (internal/child_process.js:297:11)
    at exports.spawn (child_process.js:330:9)
    at Object.rsync.execute (/path/to/project/node_modules/gulp-rsync/rsync.js:92:22)

Here's the gulpfile config:

var rsync = require('gulp-rsync');
gulp.task('deploy', function() {
  return gulp.src('**')
    .pipe(rsync({
        hostname: 'myserver.com',
        destination: '/path/to/server/directory',
        username: 'tri',
        progress: true,
        times: true,
        exclude: ['node_modules', '.DS_Store']
    }));
});
wesbos commented 9 years ago

I had this issue too - I ended up moving the gulpfile one level up, and then rsyncing it from there.

make sure to specify root otherwise it will upload as a sub-folder


gulp.task('deploy', function() {
  return gulp.src(['./CODE/**/*', '!node_modules/**/*' ])
    .pipe(p.rsync({
      hostname: 'nah.com',
      username  :'naa',
      root : 'CODE/',
      destination: '/path/to/folder',
      progress  : true
    }));
});
fergusjordan commented 8 years ago

@tnguyen14 wondering if wesbos's answer fixed this issue for you. I'm currently hitting this same issue and his answer hasn't seemed to work for me.

frob commented 8 years ago

Make sure you have the trailing slash in the root.

root: 'CODE/'

not

root: 'CODE'
apast commented 7 years ago

Dealing with a similar issue, I found the Linux System Errors documentation containing code errors and core definition. i.e.: E2BIG: Argument list too long (POSIX.1)

Reference: http://man7.org/linux/man-pages/man3/errno.3.html

In our case it makes sense, considering we are deploying 7200 files.

Considering @frob suggestion, we already applied slash, but it doesn't work for us. Someone had a similar case or have some suggestion?

Best regards!

jdewit commented 7 years ago

Remove the wildcard match in the src function and set recursive to true, like so:

gulp.task('deploy', function() {
  return gulp.src('./')
    .pipe(rsync({
      root: './',
      hostname: 'some-host',
      destination: '/var/www/some-folder',
      recursive: true
    }));
});