Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

grunt-contrig-imagemin Warning: Cannot call method 'replace' of undefined

I'm getting a weird warning when trying to use imagemin and nothing happens.

grunt imagemin:primary

Warning: Cannot call method 'replace' of undefined Used --force, continuing.
Done, but with warnings.

My task that gives me the error is as follows

  grunt.config 'imagemin'

    primary:
      options:
        optimizationLevel: 7
      expand: true
      cwd: "assets"
      src: "{img,img_two}/**/*.{jpg,jpeg,gif,png}"
      dest: "public/compiled/img"


  grunt.loadNpmTasks 'grunt-contrib-imagemin'

These don't work

src: "img/**/*.{jpg,jpeg,gif,png}"

src: "{img,img_two}/**/*.{jpg,jpeg,gif,png}"

These work

src: "img/**/*.jpg"

src: "{img,img_two}/**/*.jpg"

So it seems it doesn't like multiple extensions syntax but why, it's even how it's done in the example?

UPDATE: it seems it's just PNG that doesn't work whether I do the extension on it's own or within a group matching. I'm on Windows 8, NPM 1.4.3

https://github.com/gruntjs/grunt-contrib-imagemin/issues/219

like image 411
user391986 Avatar asked Dec 19 '22 14:12

user391986


1 Answers

Had the same problem I fixed it by deleting the grunt-contrib-imagemin directory located inside node_modules

Then I ran "npm install grunt-contrib-imagemin" to grab the latest version.

like image 121
FlashJordan Avatar answered Apr 17 '23 01:04

FlashJordan