Mika
Mika

Reputation: 5835

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

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

Upvotes: 5

Views: 2314

Answers (3)

Kimy BF
Kimy BF

Reputation: 1079

I changed in Gruntfile.js this line:

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

to this line:

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

Upvotes: 3

Umair Ahmed
Umair Ahmed

Reputation: 8787

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.

Upvotes: 17

Mika
Mika

Reputation: 5835

I had to downgrade imagemin and it now all works.

npm cache clean && npm install [email protected]

Upvotes: 8

Related Questions