yocontra / glob2base

Extracts a base path from a node-glob instance

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: Cannot read property 'length' of undefined at flattenGlob

julia-utenkova opened this issue · comments

Hello, today I received an error during gulp compilation:

TypeError: Cannot read property 'length' of undefined
    at flattenGlob (project_path/node_modules/glob2base/index.js:9:25)
    at setToBase (project_path/node_modules/glob2base/index.js:48:12)
    at module.exports (project_path/node_modules/glob2base/index.js:56:19)
    at Object.gs.createStream (project_path/node_modules/glob-stream/index.js:34:42)
    at Object.gs.create (project_path/node_modules/glob-stream/index.js:68:42)
    at Gulp.src (project_path/node_modules/vinyl-fs/lib/src/index.js:33:23)
    at Gulp.<anonymous> (project_path/gulpfile.js:144:10)
    at module.exports (project_path/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (project_path/node_modules/orchestrator/index.js:273:3)
    at Gulp.Orchestrator._runStep (project_path/node_modules/orchestrator/index.js:214:10)

Not sure why this issue appeared as my gulp configuration haven't changed, and package versions too.. I have tried to update all npm packages, but it didn't worked.. Maybe there is something i miss?

I would appreciate any help!
Many thanks in advance!

Same error here:

2016-08-22 18:21:01:[10:21:01] TypeError: Cannot read property 'length' of undefined
2016-08-22 18:21:01: at flattenGlob (/usr/src/app/node_modules/glob2base/index.js:9:25)
2016-08-22 18:21:01: at setToBase (/usr/src/app/node_modules/glob2base/index.js:48:12)
2016-08-22 18:21:01: at module.exports (/usr/src/app/node_modules/glob2base/index.js:56:19)
2016-08-22 18:21:01: at Object.gs.createStream (/usr/src/app/node_modules/glob-stream/index.js:34:42)
2016-08-22 18:21:01: at Object.gs.create (/usr/src/app/node_modules/glob-stream/index.js:68:42)
2016-08-22 18:21:01: at Gulp.src (/usr/src/app/node_modules/vinyl-fs/lib/src/index.js:33:23)
2016-08-22 18:21:01: at buildStyles (/usr/src/app/gulp/styles.js:60:17)
2016-08-22 18:21:01: at conf.paths.sassEntries.map (/usr/src/app/gulp/styles.js:54:16)
2016-08-22 18:21:01: at Array.map (native)
2016-08-22 18:21:01: at Gulp.<anonymous> (/usr/src/app/gulp/styles.js:53:38)
2016-08-22 18:21:01: at module.exports (/usr/src/app/node_modules/orchestrator/lib/runTask.js:34:7)
2016-08-22 18:21:01: at Gulp.Orchestrator._runTask (/usr/src/app/node_modules/orchestrator/index.js:273:3)
2016-08-22 18:21:01: at Gulp.Orchestrator._runStep (/usr/src/app/node_modules/orchestrator/index.js:214:10)
2016-08-22 18:21:01: at Gulp.Orchestrator.start (/usr/src/app/node_modules/orchestrator/index.js:134:8)
2016-08-22 18:21:01: at runNextSet (/usr/src/app/node_modules/run-sequence/index.js:86:16)
2016-08-22 18:21:01: at Gulp.onTaskEnd (/usr/src/app/node_modules/run-sequence/index.js:75:5)

I think its happening because of an npm package update, maybe related to gulp.

gulpjs/gulp#1768

Ditto:

[11:32:40] TypeError: Cannot read property 'length' of undefined
    at flattenGlob (./node_modules/glob2base/index.js:9:25)
    at setToBase (./node_modules/glob2base/index.js:48:12)
    at module.exports (./node_modules/glob2base/index.js:56:19)
    at Object.gs.createStream (./node_modules/gulp/node_modules/glob-stream/index.js:34:42)
    at ./node_modules/gulp/node_modules/glob-stream/index.js:80:17
    at Array.map (native)
    at Object.gs.create (./node_modules/gulp/node_modules/glob-stream/index.js:79:29)
    at Gulp.src (./node_modules/gulp/node_modules/vinyl-fs/lib/src/index.js:33:23)
    at Gulp.<anonymous> (./gulpfile.js:25:17)
    at module.exports (./node_modules/orchestrator/lib/runTask.js:34:7)

Can see loads of reports of this error across the web, seems like someone committed something they shouldn't have ...

npm -v 
3.10.3
node -v
v6.4.0
gulp -v
[11:41:37] CLI version 3.9.0
[11:41:37] Local version 3.9.1

I also met this problem today, it crashed my CI, :(

It seems a issue about minimatch in glob. In our case, the property named set of minimatch in glob is empty now, but glob2base expected it should be an array with one element at least.

Issue has been fixed now thankfully to gulpjs/gulp#1768!

wow this breaks our deployment.. glad its fix.. :)

FWIW this issue had nothing to do with this library, some other library was mutating Array.indexOf in a fucked up way and broke anything that used indexOf