Imagemin: dist task startup error

I have been trying to solve this problem for more than half a day.

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

Running my grunt command gives me the following:

`` `Performing the parallel: dist task (parallel)

 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 is 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 networks that help me. I found this open problem, but so far no one has answered: https://github.com/gruntjs/grunt-contrib-imagemin/issues/254

Thanks.

+5
source share
4 answers

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

sudo apt-get install libpng-dev

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

Running npm install and grunt now works without errors.

+6
source

In short, I am using Fedora , and my problem was resolved with:

 (sudo) yum install optipng 

Here is a long answer.

This problem was not obvious because the error message says little. In fact, this means that one or more of the four dependencies were absent (were):

 gifsicle β€” Compress GIF images jpegtran β€” Compress JPEG images optipng β€” Compress PNG images svgo β€” Compress SVG images 

And these binaries are OS dependent.

Problem Solving Process:

  • run the installation again to see what is not installed: npm install grunt-contrib-imagemin
  • Invalid google component and see how it can be installed on your OS. Install all missing. (Well, if I have to repeat step 1, I got the same error message, so that didn't help for me)
  • try running the imagemin task again. Fingers crossed.
+2
source

As the author of / @ kevva from imagemin commented on the GitHub problem in grunt-contrib-imagemin , the problem is that PR for updating mozjpeg and other dependencies to the current version are not yet included.

You are using an unsupported version of imagemin-mozjpeg (grunt-contrib-imagemin does not yet support streaming plugins). Try npm install imagemin-mozjpeg@1

...

Yes, they work great with imagemin. But grunt-contrib-imagemin has not yet updated the imagemin dependency to 2.0.0 (just built yesterday at 04b8c10), so it uses the old API.

+1
source

Imagemin error using grunt serve:dist -mode.

Instead, try the following.

  • npm uninstall
  • rm -rf node_modules
  • npm cache clean
  • npm install
+1
source

Source: https://habr.com/ru/post/1203261/


All Articles