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

試著忘記壹切 提交于 2020-01-02 04:16:09

问题


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


回答1:


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.




回答2:


I had to downgrade imagemin and it now all works.

npm cache clean && npm install grunt-contrib-imagemin@0.9.1



回答3:


I changed in Gruntfile.js this line:

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

to this line:

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


来源:https://stackoverflow.com/questions/34743770/yeaoman-grunt-imagemin-fatal-error-cannot-read-property-contents-of-undefined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!