23

I run into this error, when I try to do build a project with "grunt build".

Screenshot

There seems to be no problem when I test the project by doing "grunt server".

The project has been scaffolded and managed with: yeoman/grunt/bower. In Windows.

Everything went well and then a week ago or so it started doing this. I can't build projects no more.

When I try to install the module doing:

npm install grunt-contrib-imagemin

It can never install it, get the following "weird" error.

enter image description here

Any hints please?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
jsidera
  • 1,791
  • 1
  • 17
  • 19

8 Answers8

43

Ok I found a way to solve this:

  • In your package.json, add "jpegtran-bin": "0.2.0" before the reference to imagemin
  • Delete the node_modules folder in your project, and run "npm install" and "bower install" again

There seem to be an issue with the jpegtran's latest version.

!! - Please note this is just a workarround waiting for the bugfix.

jsidera
  • 1,791
  • 1
  • 17
  • 19
6

Like the program suggests, you need to install the npm module.

npm i --save-dev grunt-contrib-imagemin

Considering you're on Windows you might want to take a look at the project's GitHub repo for additional installation instructions.

bevacqua
  • 47,502
  • 56
  • 171
  • 285
3

There's an issue with a package contrib-imagemin references that prevents it from properly installing on Windows.

GitHub issue on grunt-contrib-imagemin: https://github.com/gruntjs/grunt-contrib-imagemin/issues/109

GitHub pull request on the offending library: https://github.com/yeoman/node-jpegtran-bin/pull/38

For now, you can manually specify "jpegtran-bin": "0.2.0" in your package.json and it should function as a workaround. If it's a pain point for you, go comment on that pull request and perhaps it'll convince the project maintainer to actually take a look and comment as well.

antinescience
  • 2,339
  • 23
  • 31
3

I had the same problem with 0.3.0 version, but once I updated to 0.4.0 the problem was solved. Check your package.json. Hope that helps!

"grunt-contrib-imagemin": "~0.4.0",
2

As of May 2015 I solved this by deleting node_modules and running npm install.

Henry
  • 7,721
  • 2
  • 38
  • 38
0

I am using windows, I was getting same error. So I edited the Environmental Variables.

Just add: C:\Ruby200-x64\bin to your PATH variable and restart node prompt.

jAC
  • 5,195
  • 6
  • 40
  • 55
virajzaveri
  • 81
  • 2
  • 7
0

The imagemin install seems to not run correctly when called by grunt-contrib-imagemin. I just do

cd ./node_modules/grunt-contrib-imagemin/node_modules/imagemin
npm install

And then it's fine.

Allen
  • 478
  • 9
  • 21
0

On Ubuntu 14.04.3 LTS, package.json containing:

 "grunt-contrib-imagemin": "~0.4.0",

I had to reinstall Grunt (but the jpegtran-bin workaround, or just removing node_modules and running npm install wasn't enough, I needed the following (with sudo):

rm -rf node_modules/
sudo npm update -g npm
sudo npm install -g grunt-cli
William Turrell
  • 3,227
  • 7
  • 39
  • 57