5

I keep on getting when running grunt build even with a clean Yeoman angular build: yo angular whatever.

Warning: Running "imagemin:dist" (imagemin) task

Fatal error: Cannot read property 'contents' of undefined

Community
  • 1
  • 1
Mika
  • 5,807
  • 6
  • 38
  • 83

3 Answers3

17

just update your grunt-contrib-imagemin version.

Ex: "grunt-contrib-imagemin": "^0.9.2"

to

"grunt-contrib-imagemin": "^1.0.0"

it's work for me.

Umair Ahmed
  • 8,337
  • 4
  • 29
  • 37
8

I had to downgrade imagemin and it now all works.

npm cache clean && npm install grunt-contrib-imagemin@0.9.1
Mika
  • 5,807
  • 6
  • 38
  • 83
3

I changed in Gruntfile.js this line:

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

to this line:

src: '[*/*.{png,jpg,jpeg,gif,svg}]'
Kimy BF
  • 1,029
  • 3
  • 13
  • 23