Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Newest version of grunt-contrib-imagemin reports error 'spawn ENOENT'?

I used to execute grunt-contrib-imagemin to compress png etc, but it doesn't work after I updated it. I find it goes wrong since v0.2.0 The error message as follows:

PS F:\PHPnow-1.5.6\htdocs\map> grunt imagemin -g gruntfile.js -s
Running "imagemin:dist" (imagemin) task
✔ app/images/apple-touch-icon.png (saved 11.99 kB)
✔ app/images/bg_loading.png (saved 7.68 kb)
✔ app/images/bg_positiong_no.png (saved 7.59 kb)
✔ app/images/button-green-press.png (saved 1.13 kB)
✔ app/images/button-green.png (saved 1.13 kB)
✔ app/images/button-red-press.png (saved 1.13 kB)
✔ app/images/button-red.png (saved 1.11 kB)
Fatal error: spawn ENOENT
like image 767
Youth overturn Avatar asked Dec 03 '25 12:12

Youth overturn


1 Answers

I am also facing this issue right now. But for me only JPEG images have this issues, not PNG.

I have separated targets for both like:

 imagemin: {
        png: {
            options: {
                optimizationLevel: 7,
                pngquant: true
            },
            files: [{
                expand: true,
                cwd:"images/",
                src: ["**/*.png"],
                dest: "images/r/",
                ext: ".png"
            }]
        },

        jpg: {
            options: {
                progressive: true
            },
            files: [{
                expand: true,
                cwd:"images/",
                src: ["**/*.jpg"],
                dest: "images/r/",
                ext: ".jpg"
            }]              
        } 
  },

Now grunt imagemin:png does not have this error but grunt imagemin:jpg does. Hope this helps you slightly.

More follow here: https://github.com/gruntjs/grunt-contrib-imagemin/issues/61#issuecomment-28982953

like image 111
Shekhar K. Sharma Avatar answered Dec 06 '25 02:12

Shekhar K. Sharma



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!