Since today whenever I do a clean install of gulp I get the following error:
TypeError: Cannot read property 'length' of undefined
[10:38:42] TypeError: Cannot read property 'length' of undefined
at flattenGlob (/Users/miguel/src/reco2/node_modules/glob2base/index.js:9:25)
at setToBase (/Users/miguel/src/reco2/node_modules/glob2base/index.js:48:12)
at module.exports (/Users/miguel/src/reco2/node_modules/glob2base/index.js:56:19)
at Object.gs.createStream (/Users/miguel/src/reco2/node_modules/glob-stream/index.js:34:42)
at /Users/miguel/src/reco2/node_modules/glob-stream/index.js:80:17
at Array.map (native)
at Object.gs.create (/Users/miguel/src/reco2/node_modules/glob-stream/index.js:79:29)
at Gulp.src (/Users/miguel/src/reco2/node_modules/vinyl-fs/lib/src/index.js:33:23)
at Gulp.<anonymous> (/Users/miguel/src/reco2/gulpfile.js:13:8)
at module.exports (/Users/miguel/src/reco2/node_modules/orchestrator/lib/runTask.js:34:7)
Same here, the error seems to be triggered by any gulp.src() call : /
+1 Same error here, anyone found a workaround?
Nope, try to debugging, but no idea. The error appears this morning after I cleaned all my node_modules repo and made a npm i in my project. :(
Same here, debugging. gulp 3.9.1, node 4.5.0 LTS on OS X 10.11.6
+1 same problem
windows os seems has not this problem.
I got WARNS in my logs of npm i about deprecated minimatch version. Minimatch is used in many gulp modules. I am not sure it is related.
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
Same here:
TypeError: Cannot read property 'length' of undefined
at flattenGlob (/Users/user/Sites/project/node_modules/glob2base/index.js:9:25)
at setToBase (/Users/user/Sites/project/node_modules/glob2base/index.js:48:12)
at module.exports (/Users/user/Sites/project/node_modules/glob2base/index.js:56:19)
at Object.gs.createStream (/Users/user/Sites/project/node_modules/vinyl-fs/node_modules/glob-stream/index.js:34:42)
at /Users/user/Sites/project/node_modules/vinyl-fs/node_modules/glob-stream/index.js:80:17
at Array.map (native)
at Object.gs.create (/Users/user/Sites/project/node_modules/vinyl-fs/node_modules/glob-stream/index.js:79:29)
at Gulp.src (/Users/user/Sites/project/node_modules/vinyl-fs/lib/src/index.js:33:23)
at module.exports (/Users/user/Sites/project/.build/tasks/javascript.js:11:17)
at /Users/user/Sites/project/gulpfile.js:34:52
at Array.map (native)
at Gulp.<anonymous> (/Users/user/Sites/project/gulpfile.js:33:46)
at module.exports (/Users/user/Sites/project/node_modules/orchestrator/lib/runTask.js:34:7)
at Gulp.Orchestrator._runTask (/Users/user/Sites/project/node_modules/orchestrator/index.js:273:3)
at Gulp.Orchestrator._runStep (/Users/user/Sites/project/node_modules/orchestrator/index.js:214:10)
at Gulp.Orchestrator.start (/Users/user/Sites/project/node_modules/orchestrator/index.js:134:8)
Triggered by the call gulp.src(options.src). options.src being a path string value
Also hitting it in the build of Microsoft/vscode.
Seems to have been due to some npm dependency update...
I can confirm this, even with an empty task:
[12:02:25] Using gulpfile ~/dev/teleport-skin/skin-builder/gulpfile.js
[12:02:25] Starting 'default'...
[12:02:25] Starting 'test'...
[12:02:25] 'test' errored after 3.83 ms
[12:02:25] TypeError: Cannot read property 'length' of undefined
at flattenGlob (/home/pierre/dev/teleport-skin/skin-builder/node_modules/glob2base/index.js:9:25)
at setToBase (/home/pierre/dev/teleport-skin/skin-builder/node_modules/glob2base/index.js:48:12)
at module.exports (/home/pierre/dev/teleport-skin/skin-builder/node_modules/glob2base/index.js:56:19)
at Object.gs.createStream (/home/pierre/dev/teleport-skin/skin-builder/node_modules/glob-stream/index.js:34:42)
at Object.gs.create (/home/pierre/dev/teleport-skin/skin-builder/node_modules/glob-stream/index.js:68:42)
at Gulp.src (/home/pierre/dev/teleport-skin/skin-builder/node_modules/vinyl-fs/lib/src/index.js:33:23)
at Gulp.<anonymous> (/home/pierre/dev/teleport-skin/skin-builder/gulpfile.js:93:17)
at module.exports (/home/pierre/dev/teleport-skin/skin-builder/node_modules/orchestrator/lib/runTask.js:34:7)
at Gulp.Orchestrator._runTask (/home/pierre/dev/teleport-skin/skin-builder/node_modules/orchestrator/index.js:273:3)
at Gulp.Orchestrator._runStep (/home/pierre/dev/teleport-skin/skin-builder/node_modules/orchestrator/index.js:214:10)
I'm guessing everyone with publish access to npm is asleep, but if we can figure out which dependency has broken, you can install the old version manually in your root package.json and gulp will use the old version, instead of the new version.
Out of interest, is anyone having this problem with gulp 4?
@enna: unrelated
vinyl-fs dependency in gulp 3.9.1 is ^0.3.0.
cd node_modules/gulp
nano package.json
change vinyl-fs dep from ^0.3.0 to 2.4.3
node_modules/gulp/npm install .
Get errors, but after updating vinyl-fs, gulp 3.9.1 seems to work.
verify with
npm ls vinyl-fs
[email protected] /Users/sulmanen/work/site
โโโฌ [email protected]
โโโ [email protected]
Seems to be a glob2base issue, and there's a pull there https://github.com/contra/glob2base/pull/9/files
I see another strange thing.
From today, if I log a simple config array, I got "Circular" instead of simple array of strings
{ js:
{ src: [ [Circular] ],
watch: [ [Circular] ],
dest: 'web/public/build/js',
filename: 'bundle.js' },
css:
{ src:
[ 'node_modules/normalize.css/normalize.css',
'node_modules/jquery-bar-rating/dist/themes/css-stars.css',
'web/public/src/sass/client.scss' ],
watch: [ [Circular] ],
dest: 'web/public/build/css',
filename: 'bundle.css' },
app: { watch: [ 'web/**/*', '!web/public/**/*' ] } }
Instead of
{
js: {
src: [
'web/public/src/js/client.js'
],
watch: [
'web/public/src/js/**/*.@(js|json|html)'
],
dest: 'web/public/build/js',
filename: 'bundle.js'
},
css: {
src: [
'node_modules/normalize.css/normalize.css',
'node_modules/jquery-bar-rating/dist/themes/css-stars.css',
'web/public/src/sass/client.scss'
],
watch: [
'web/public/src/**/*.scss'
],
dest: 'web/public/build/css',
filename: 'bundle.css'
},
app: {
watch: [
'web/**/*',
'!web/public/**/*'
]
}
}
@sulmanen's fix didn't work for me
@sulmanen: Given that there haven't been any recent updates to it or any or its single dependency, I doubt it's an issue with that module
@callumacrae you're right, seems more like a symptom.
@joshbalfour it's a bit hackish but my ci is running now. Verify with
npm ls vinyl-fs
[email protected] /Users/sulmanen/work/site
โโโฌ [email protected]
โโโ [email protected]
@sulmanen I've verified and am still seeing the issue, will be interested to see the results of your CI
โโโฌ [email protected]
โ โโโ [email protected]
โโโ [email protected]
(my bad, wrong button)
I am having the same problem from a couple of hours ago. I don't know how to fix this, any good news?
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
After adding output before usage of minimatch.set in glob2base, I got the minimatch object as below:
Minimatch {
options:
{ read: true,
buffer: true,
cwd: '/home/cfeeling/Projects/frontend-web',
dot: false,
silent: true,
nonull: false,
cwdbase: false },
set: [],
pattern: '/home/cfeeling/Projects/frontend-web/build',
regexp: null,
negate: false,
comment: false,
empty: false,
globSet: [ [Circular] ],
globParts:
[ [ '',
'home',
'cfeeling',
'Projects',
'frontend-web',
'build' ] ] }
@cfeeling could https://github.com/contra/glob2base/pull/11 fix this?
@joshbalfour
npm-install:
[echo] If this fails, make sure you have 'npm' in your path.
[exec] - [email protected] node_modules/less/node_modules/source-map
[exec] [email protected] /mnt/jenkins/su-new-svg-icons-se/workspace
[exec] โโโ [email protected]
[exec]
[exec] npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
[exec] npm WARN notsup Not compatible with your operating system or architecture: [email protected]
[exec] npm WARN [email protected] license should be a valid SPDX license expression
babel:
[exec] [10:43:41] Using gulpfile /mnt/jenkins/su-new-svg-icons-se/workspace/gulpfile.js
[exec] [10:43:41] Starting 'babel'...
translations2ascii:
[native2ascii] Converting 13 files from /mnt/jenkins/su-new-svg-icons-se/workspace/src/main/resources/i18n to /mnt/jenkins/su-new-svg-icons-se/workspace/src/main/resources/i18n
used to fail with gulp babel
@joshbalfour I will try it ASAP, plz wait a moment
@joshbalfour It just disable the error, but any actions followed it can not be executed anymore
@joshbalfour @cfeeling it will silence the error, but still fail as undefined is passed into it. The issue is around why undefined is being passed into the method
@callumacrae I'm still seeing the issue with
[email protected] /Users/joshuabalfour/Projects/Gousto2-FrontEnd/src
โโโฌ [email protected]
โ โโโ UNMET DEPENDENCY vinyl-fs@^0.3.0
โโโ [email protected]
@delta98 I agree it, the core is why minimatch.set is empty now instead of an array with one element at least.
It makes no sense at all... but when we (Microsoft/vscode) comment out this line, which requires gulp-cssnano, the error goes away. It's as if some dependency within gulp-cssnano interferes with some dependency within gulp.
@joaomoreno we also use gulp-cssnano but I don't think it's the root issue.
@delta98 Give it a try. It's highly reproducible for me.
@delta98 commenting gulp-cssnano fixes it for me
I just tried to remove the use of cssnano @joaomoreno and it fixed the problem on my side too.
@delta98 commenting gulp-cssnano fixes it for me also
@delta98 gulp-cssnano fixes it for me also too
@delta98 I think gulp-cssnano is not the core.
I did not use gulp-cssnano, only gulp and gulp-clean was used in my case, but I also met this problem.
@joaomoreno yeah, it stops the error, but something must have changed within the package, or cascades through that plugin. As @cfeeling says it's not used on his project.
@cfeeling I don't think so, bcs gulp-cssnano has last update 4 month ago
Having the same issue here...
I don't have gulp-cssnano in my gulpfile config, so I still get the error..
running npm install in gulp-cssnano also fixed this for me
Looking at cssnano deps it uses the following:
"cssnano": "^3.0.0",
"gulp-util": "^3.0.6",
"object-assign": "^4.0.1",
"vinyl-sourcemaps-apply": "^0.2.1"
I think there is a common strand which might be the root cause, @cfeeling are you using any of these packages or are you uses a package that uses these?
This has been fixed upstream, delete node_modules and reinstall should work now
@TheSpyder what was the package?
The bug was in a new dependency of postcss-calc, used by cssnano. It had a broken polyfill of Array.prototype.indexOf.
@delta98 lots of packages are using those four packages
Now it works! Many thanks @TheSpyder ! You are my hero! <3
For the curious, bug reference MoOx/reduce-css-calc#13
Good stuff. Thanks, @TheSpyder.
The actual fix is here, caused by a library globally patching Array.prototype.indexOf with a dodgy comparison, and breaking it: https://github.com/redhivesoftware/math-expression-evaluator/pull/2
Closing this issue now.
@TheSpyder It works well, u r also my hero
Thanks for fixing it!!!!
yeah, the chain is about 5 dependencies long. Didn't think I needed to draw too much attention to the underlying issue :)
Please react with the :+1: or ๐ emoji on one of @TheSpyder's messages instead of writing an appreciative comment, thank you! There are 18 participants in this thread, and you are sending all of them notifications / emails.
Most helpful comment
This has been fixed upstream, delete
node_modulesand reinstall should work now