gulp-rsync icon indicating copy to clipboard operation
gulp-rsync copied to clipboard

Error: spawn E2BIG

Open tnguyen14 opened this issue 10 years ago • 5 comments

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 [email protected]:/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']
    }));
});

tnguyen14 avatar Jun 23 '15 03:06 tnguyen14

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
    }));
});

wesbos avatar Jun 23 '15 17:06 wesbos

@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.

fergusjordan avatar Nov 20 '15 09:11 fergusjordan

Make sure you have the trailing slash in the root.

root: 'CODE/'

not

root: 'CODE'

frob avatar Feb 18 '16 22:02 frob

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!

apast avatar Sep 02 '16 23:09 apast

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
    }));
});

jdewit avatar Sep 25 '16 13:09 jdewit