Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

imagemin:dist task throwing error

I've been attempting to solve this for over half the day now.

I have an angularjs project that I use grunt to build.

Running my grunt command give me the following:

``` Running "concurrent:dist" (concurrent) task

Running "svgmin:dist" (svgmin) task
Total saved: 0 B

Done, without errors.


Execution Time (2014-09-23 21:53:55 UTC)
loading tasks   7ms  ▇▇▇▇▇▇ 11%
svgmin:dist    58ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 89%
Total 65ms
    Warning: Running "imagemin:dist" (imagemin) task
Fatal error: Object #<DestroyableTransform> has no method 'apply'


Execution Time (2014-09-23 21:53:55 UTC)
imagemin:dist  868ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 99%
Total 876ms Use --force to continue.

    Aborted due to warnings.

```

Here's my imagemin task in my GruntFile.js:

imagemin: { dist: { files: [ { expand: true, cwd: '<%= yeoman.app %>/images', src: '{,*/}*.{png,jpg,jpeg,gif}', dest: '<%= yeoman.dist %>/images' } ] } }

I can't find anything on the interwebs that helps me. I did find this open issue, but no one has responded as of yet: https://github.com/gruntjs/grunt-contrib-imagemin/issues/254

Thanks.

like image 266
RavenHursT Avatar asked Sep 23 '14 22:09

RavenHursT


3 Answers

In short, I am using Fedora and my problem was solved by:

(sudo) yum install optipng

Here is the long answer.

This problem was not obvious because the error message does not tell much. It actually means one or more of the four dependencies was(were) missing:

gifsicle — Compress GIF images
jpegtran — Compress JPEG images
optipng — Compress PNG images
svgo — Compress SVG images

And those binaries are OS dependent.

The problem solving process is:

  1. run the installation again to see what are not installed: npm install grunt-contrib-imagemin
  2. google the failing component and see how that can be installed in your OS. Install all missing ones. (Well, if I should repeat step 1, I have gotten the same failure message, so for me it didn't help)
  3. then try run imagemin task again. Fingers crossed.
like image 39
chfw Avatar answered Oct 31 '22 10:10

chfw


Apparently, png compression requires the libpng-dev library and I needed to install that on my build server using:

sudo apt-get install libpng-dev

I also updated my package.json to use the latest grunt-contrib-imagemin ("^0.8.0")

Running npm install and grunt now work w/o errors.

like image 50
RavenHursT Avatar answered Oct 31 '22 09:10

RavenHursT


imagemin error through using grunt serve:dist-mode.

Try the following instead.

  1. npm uninstall
  2. rm -rf node_modules
  3. npm cache clean
  4. npm install
like image 2
vinodh Avatar answered Oct 31 '22 10:10

vinodh