sindresorhus / gulp-imagemin

Minify PNG, JPEG, GIF and SVG images
MIT License
1.9k stars 157 forks source link

Task Failing on notFoundError node_modules\cross-spawn\lib\enoent.js #245

Closed jaegz closed 7 years ago

jaegz commented 7 years ago

Running gulp-imagemin task throws the following error:

events.js:160
      throw er; // Unhandled 'error' event
      ^
Error: The system cannot find the path specified.

    at notFoundError (C:\dev\test\node_modules\execa\node_modules\cross-spawn\lib\enoent.js:11:11)
    at verifyENOENT (C:\dev\test\node_modules\execa\node_modules\cross-spawn\lib\enoent.js:46:16)
    at ChildProcess.cp.emit (C:\dev\test\node_modules\execa\node_modules\cross-spawn\lib\enoent.js:33:19)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)

Environment Details npm 4.1.2 node 6.9.4 win32 x64 (windows 7) cmdr admin console gulp 3.9.1 gulp-imagemin 3.1.1

Gulp task

var gulp = require('gulp');
var imagemin = require('gulp-imagemin');

var src = {
    img : './src/img/**/*',
}

var public = {
    img : './public/img'
}

gulp.task( 'images', function() {
    gulp.src(src.img)
        .pipe(imagemin())
        .pipe(gulp.dest(public.img))
        .pipe(notify({ message: 'gulp images complete', onLast: true }))
});
onemeangrilledcheese commented 7 years ago

I'm getting the same error. I'm using:

windows 10 npm: 4.2.0 node: 7.5.0 gulp-imagemin: 3.0.3 also using cmder console

Princeraul commented 7 years ago

I'm getting them same error, window10 node v7.7.1 npm 4.1.2 gulp-imagemin 3.1.1

flobacher commented 7 years ago

same here: win 10 node 6.5.0 npm 3.10.3

ghost commented 7 years ago

Same error.

Environment Details win 10 x64 node 7.7.1 npm 4.2.0 gulp 3.9.1

flobacher commented 7 years ago

could 'fix' it by using yarn instead of npm to install dependencies.. not sure if this is a real fix, or just coincidence though

montalvomiguelo commented 7 years ago

Same but if we try to pass arguments to imagemin it works:

.pipe(imagemin([], {}))
BenjaVR commented 7 years ago

The install.js script from some plugins did not run, so executing this fixed it for me:

node node_modules/jpegtran-bin/lib/install.js
node node_modules/optipng-bin/lib/install.js
kevva commented 7 years ago

@montalvomiguelo, in your example no plugin will run and therefore no images will be minified.

crick64 commented 7 years ago

Have you try to install npm inside the gulp-imagemin directory:

cd path\to\the\project\node_modules\gulp-imagemin
npm i

Then re-try. Good luck ;)

mvbrocs commented 7 years ago

crick64 commented on 7 Aug - This healp me. Thanks!

kevva commented 7 years ago

Well, it's not directly related to gulp-imagemin. One of the imagemin plugins failed to install. Try re-installing, or check the error message upon installing and open an issue at the adequate repository.

nicolasfleurent commented 6 years ago

Thanks a lot crick64. It works.

congzhou09 commented 6 years ago

@crick64 Could you please make a brief interpretation, many thanks!

JeanDevonne commented 6 years ago

@crick64 Muchas grácias :)

AleksNikos commented 5 years ago

Have you try to install npm inside the gulp-imagemin directory:

cd path\to\the\project\node_modules\gulp-imagemin
npm i

Then re-try. Good luck ;)

Its work

rahoo303 commented 5 years ago

Have you try to install npm inside the gulp-imagemin directory:

cd path\to\the\project\node_modules\gulp-imagemin
npm i

Then re-try. Good luck ;)

Great, Its working. ...

JaimePata commented 5 years ago

@crick64 answer works.. but why?

Gabby-eurocontrol commented 3 years ago

Have you try to install npm inside the gulp-imagemin directory:

cd path\to\the\project\node_modules\gulp-imagemin
npm i

Then re-try. Good luck ;)

Worked like a charm!! Thanks so much!

nikos-aleks commented 3 years ago

@crick64 answer works.. but why? In directory \node_modules\gulp-imagemin had package.json with dependencies for gulp-imagemin And command npm i install all dependencies for current package