node.jsgulpgulp-imagemin

EACCES Error with Gulp-Imagemin


I'm trying to make a gulp task work but I'm getting this error:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn EACCES
    at errnoException (child_process.js:988:11)
    at Process.ChildProcess._handle.onexit (child_process.js:779:34)

It didn't say much about the error itself, so I installed "superstack" and got this:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn EACCES
    at errnoException (child_process.js:988:11)
    at Process.ChildProcess._handle.onexit (child_process.js:779:34)
    at DuplexWrapper.Readable.on (/var/www/public/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/stream-combiner2/node_modules/duplexer2/node_modules/readable-stream/lib/_stream_readable.js:703:33)
    at Imagemin.run (/var/www/public/node_modules/gulp-imagemin/node_modules/imagemin/index.js:80:9)
    at DestroyableTransform.through.obj.percent (/var/www/public/node_modules/gulp-imagemin/index.js:56:12)
    at DestroyableTransform._transform (/var/www/public/node_modules/gulp-imagemin/node_modules/through2-concurrent/through2-concurrent.js:29:15)
    at DestroyableTransform.Transform._read (/var/www/public/node_modules/gulp-imagemin/node_modules/through2-concurrent/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:10)
    at DestroyableTransform.Transform._write (/var/www/public/node_modules/gulp-imagemin/node_modules/through2-concurrent/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:160:12)
    at doWrite (/var/www/public/node_modules/gulp-imagemin/node_modules/through2-concurrent/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:326:12)
    at writeOrBuffer (/var/www/public/node_modules/gulp-imagemin/node_modules/through2-concurrent/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:312:5)

Any idea why I'm getting this error? What can I do to fix it?

Thanks a lot!

EDIT:

This is the task I'm trying to run.

gulp.task('build-images', function(){
    return gulp.src('app/assets/src/**/*.+(png|jpg|gif|jpeg)')
        .pipe($.debug({title:'BEFORE'}))
        .pipe(imagemin({
            progressive: true,
            svgoPlugins: [{removeViewBox: false}],
            use: [pngquant()]
        }))
        .pipe($.debug({title:'AFTER'}))
        .pipe(gulp.dest('dest/images'));
});

Solution

  • That is a permissions error. Make sure you have read and write access to all of those files and directories.