WordPress-Starter-Theme
WordPress-Starter-Theme copied to clipboard
Grunt imagemin error - "Cannot read property 'contents' of undefined"
When I run grunt, it fails at imagemin:dist
. I haven't modified any code in any ways.
I'm running Windows 10, with node version 6.9.1 and npm version 3.10.8.
Expected behavior
Execute the imagemin:dist
without errors
Actual behavior
Returned error Fatal error: Cannot read property 'contents' of undefined
Console log
$ grunt
Running "sass:dist" (sass) task
Running "autoprefixer:files" (autoprefixer) task
>> 2 autoprefixed stylesheets created.
>> 2 sourcemaps created.
Running "cssmin:minify" (cssmin) task
>> 2 files created. 23.21 kB → 7.5 kB
Running "uglify:plugins" (uglify) task
>> 1 sourcemap created.
>> 1 file created.
Running "uglify:main" (uglify) task
>> 1 sourcemap created.
>> 1 file created.
Running "imagemin:dist" (imagemin) task
Fatal error: Cannot read property 'contents' of undefined
I haven't taken a look at this code in quite a while. I'm guessing that the packages and API's have changed. Try upgrading the package versions and see if that changes anything.
https://github.com/gruntjs/grunt-contrib-imagemin/issues/330#issuecomment-196789102 helped me resolve this issue. Instead of adding ^1.0.0
, I added ~1.0.0
though.
Update package.json in #27