Search code examples
javascriptangularjsgruntjsgrunt-contrib-imagemin

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.


Solution

  • 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.