question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Singular glob in an array of globs throws file not found error

See original GitHub issue

When using Gulp v4 (using vinyl-fs@2.4.4) and a singular glob in an array of globs doesn’t match a file, the task fails with an error. The same glob configuration doesn’t fail in Gulp v3. For example if foo.map exists but b.json doesn’t, this task:

gulp.task('angry', function testTask() {
  return gulp.src(['*.map', 'b.json'])
    .pipe(gulp.dest('./output'));
});

will output:

[12:01:43] Using gulpfile ~/Documents/glob-bug/gulpfile.js
[12:01:43] Starting 'angry'...
[12:01:43] 'angry' errored after 45 ms
[12:01:43] Error: File not found with singular glob: /Users/vdh/Documents/glob-bug/b.json
    at Glob.<anonymous> (/Users/vdh/Documents/glob-bug/node_modules/glob-stream/index.js:41:11)
    at Glob.g (events.js:291:16)
    at emitOne (events.js:96:13)
    at Glob.emit (events.js:188:7)
    at Glob._finish (/Users/vdh/Documents/glob-bug/node_modules/glob/glob.js:172:8)
    at done (/Users/vdh/Documents/glob-bug/node_modules/glob/glob.js:159:12)
    at Glob._processSimple2 (/Users/vdh/Documents/glob-bug/node_modules/glob/glob.js:652:12)
    at /Users/vdh/Documents/glob-bug/node_modules/glob/glob.js:640:10
    at Glob._stat2 (/Users/vdh/Documents/glob-bug/node_modules/glob/glob.js:736:12)
    at lstatcb_ (/Users/vdh/Documents/glob-bug/node_modules/glob/glob.js:728:12)

The full reproduction of the issue is in this gist: https://gist.github.com/vdh/89958706d508dfda9b3c8cca8f46feb4

The gist also includes glob-stream.js for reproducing the bug without gulp or vinyl-fs.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
phatedcommented, Nov 16, 2016

@vdh thanks, perfect. I’ll dig into this when I have some free time.

0reactions
phatedcommented, Dec 14, 2016

Everything is undocumented because we haven’t shipped. You can build a glob with your singular file included and it will also solve your problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gulp throwing error: File not found with singular glob
main.css file no longer exists as I changed it to style.css but for some reason it is searching for the old file.
Read more >
src()
name type default buffer boolean function true read boolean function true since date timestamp function
Read more >
File Not Found With Singular Glob Site Stackoverflow.com
File Not Found With Singular Glob Site Stackoverflow.com. I have been building and rebuilding an ASP.NET program. I made the horrible mistake, I...
Read more >
Gulp Error: File not found with singular glob:
Gulp Error: File not found with singular glob: I am getting the following error runing Gulp. c:\>gulp. [10:57:02] Using gulpfile C:\gulp_project\gulpfile.js.
Read more >
perldata - Perl data types - Perldoc Browser
This means that you can, without fear of conflict, use the same name for a scalar variable, an array, or a hash--or, for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found