Reputation: 59634
I am trying to compress images with grunt-contrib-imagemin ~0.9.4
in a node.js
application. My config is:
imagemin: {
dynamic: {
files: [{
expand: true,
cwd: 'server/static/img/',
src: ['**/*.{jpg,gif,png}'],
dest: '_public/incl/img/'
}]
}
},
I systematically get a Error: spawn ENOENT in file somepath/someimage.png
message. It fails at the first processed .png
file. When I don't include .png
files, it all works fine.
I have read somewhere that I should copy the image files first in the target directory as a workaround. I have tried this, but it does not solve the issue.
I am on Windows 7 32-bits and I am using grunt ~0.4.5
. How can I solve this issue?
Upvotes: 5
Views: 6663
Reputation: 65
Just delete the node_modules folder and then run npm install
or npm i
to install all the modules again
Upvotes: 0
Reputation: 6157
This rebuild
fixed my problem.
Laravel Mix Issues Optimising Images in Sass Files | Andy Carter
$ npm rebuild mozjpeg $ npm rebuild gifsicle $ npm rebuild optipng-bin
Upvotes: 3
Reputation: 58
Seems to be caused by a recent change in a package that imagemin is dependent on. The new setup doesn't support proxies until someone fixes it. https://github.com/kevva/download/issues/64
This thread suggests downgrading bin-build from 2.1.2 to 2.1.1
Upvotes: 1
Reputation: 200
Blow away node_modules/grunt-contrib-imagemin and try and do a npm install
again. The node equivalent of “did you restart it”?
I see in their github repo they have a couple of issues related to pngs, but nothing like you are seeing.
Upvotes: 7