Yeaoman Grunt imagemin Fatal error: Cannot read property 'contents' of undefined

2.3k Views Asked by At

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

3

There are 3 best solutions below

1
Umair Ahmed On BEST ANSWER

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.

0
Mika On

I had to downgrade imagemin and it now all works.

npm cache clean && npm install [email protected]
2
Kimy BF On

I changed in Gruntfile.js this line:

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

to this line:

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