Yeaoman Grunt imagemin Fatal error: Cannot read pr

2019-05-03 06:42发布

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条回答
ゆ 、 Hurt°
2楼-- · 2019-05-03 07:19

I changed in Gruntfile.js this line:

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

to this line:

src: '[*/*.{png,jpg,jpeg,gif,svg}]'
查看更多
smile是对你的礼貌
3楼-- · 2019-05-03 07:30

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.

查看更多
甜甜的少女心
4楼-- · 2019-05-03 07:33

I had to downgrade imagemin and it now all works.

npm cache clean && npm install grunt-contrib-imagemin@0.9.1
查看更多
登录 后发表回答