ben-eb/gulp-svgmin

Cannot read property 'filter' of undefined

vdecree opened this issue · 1 comments

Hi there,

Hopefully this is the right place to post this. I'm getting an error that I've never had before and randomly mid-way through a project:

C:\Users\mathew\Documents\Work\builds\www\projectname\node_modules\gulp-svgmin\node_modules\svgo\lib\svgo\plugins.js
:46
        items.content = items.content.filter(function(item) {
                                     ^
TypeError: Cannot read property 'filter' of undefined
    at monkeys (C:\Users\mathew\Documents\Work\builds\www\projectname\node_modules\gulp-svgmin\node_modules\svgo\lib
\svgo\plugins.js:46:38)
    at perItem (C:\Users\mathew\Documents\Work\builds\www\projectname\node_modules\gulp-svgmin\node_modules\svgo\lib
\svgo\plugins.js:77:12)
    at C:\Users\mathew\Documents\Work\builds\www\projectname\node_modules\gulp-svgmin\node_modules\svgo\lib\svgo\plu
gins.js:18:24
    at Array.forEach (native)
    at module.exports (C:\Users\mathew\Documents\Work\builds\www\projectname\node_modules\gulp-svgmin\node_modules\s
vgo\lib\svgo\plugins.js:14:13)
    at C:\Users\mathew\Documents\Work\builds\www\projectname\node_modules\gulp-svgmin\node_modules\svgo\lib\svgo.js:
63:17
    at Object.sax.onend (C:\Users\mathew\Documents\Work\builds\www\projectname\node_modules\gulp-svgmin\node_modules
\svgo\lib\svgo\svg2js.js:140:26)
    at emit (C:\Users\mathew\Documents\Work\builds\www\projectname\node_modules\gulp-svgmin\node_modules\svgo\node_m
odules\sax\lib\sax.js:625:33)
    at end (C:\Users\mathew\Documents\Work\builds\www\projectname\node_modules\gulp-svgmin\node_modules\svgo\node_mo
dules\sax\lib\sax.js:667:3)
    at Object.write (C:\Users\mathew\Documents\Work\builds\www\projectname\node_modules\gulp-svgmin\node_modules\svg
o\node_modules\sax\lib\sax.js:929:30)

I've not changed anything or update any files. Can anyone point me in the right direction?

If I remove the svgmin task itself the build succeeds.

The task looks like:

gulp.task('svgmin', function() {
    return gulp.src('assets/images/svg/*.svg')
      .pipe(plumber())
        .pipe(svgmin())
        .pipe(gulp.dest('assets/images/svg'))
        .pipe(notify({message: 'svgs minified!'}));
});

svg/svgo#432 is the correct place for this discussion. 😄