Reputation: 417
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
Upvotes: 3
Views: 5717
Reputation: 3567
There is a workaround for this problem here: Npm module "grunt-contrib-imagemin" not found, Is it installed?
The recommended solution worked for me.
Upvotes: 1
Reputation: 3063
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
Upvotes: 2