After renaming my file I am getting the following error when running the gulp build task:
Error: Error: File not found with singular glob: F:ProjectsxyzHTMLappcssmain.css
at DestroyableTransform.<anonymous> (F:ProjectsxyzHTMLnode_modulesgulp-usereflibstreamManager.js:90:36)
main.css file no longer exists as I changed it to style.css but for some reason it is searching for the old file.
asked Apr 25, 2016 at 11:54
Imran BughioImran Bughio
4,7812 gold badges29 silver badges52 bronze badges
As it turns out I missed changing file name in HTML file as it was calling main.css instead of style.css.
<!--build:css css/main.min.css -->
<link rel="stylesheet" href="css/main.css">
<!-- endbuild -->
Changed it to:
<!--build:css css/style.min.css -->
<link rel="stylesheet" href="css/style.css">
<!-- endbuild -->
An honest mistake but I believe someone else can run into something similar
Ahmed Ashour
5,02910 gold badges35 silver badges54 bronze badges
answered Apr 25, 2016 at 11:54
Imran BughioImran Bughio
4,7812 gold badges29 silver badges52 bronze badges
1
In my case, removing these files:
package-lock.json
node_modules
folder- any
.tmp
ordist
folder
And then reinstall dependencies using:
npm i
answered May 16, 2022 at 20:52
Собираю gulp-сборку по уроку из Youtube. На создании таска JS я встрял. Сам таск написал, отслеживание js файлов повесил, в сборку включил.
Пробовал гуглить, читал через переводчик ишью на гитхабе, но не вышло разобраться.
gulpfile.js
Клик
let project_folder='dist';
let source_folder='src';
let path = {
build: {
html: project_folder + '/',
css: project_folder + '/css/',
js: project_folder + '/js/',
img: project_folder + '/img/',
fonts: project_folder + '/fonts/'
},
src: {
html: [source_folder + '/*.html', '!' + source_folder + '/_*.html'],
css: source_folder + '/scss/style.scss',
js: source_folder + '/js/sctipt.js',
img: source_folder + '/img/**/*.{jpg,png,svg,gif,icon,webp}',
fonts: source_folder + '/fonts/'
},
watch: {
html: source_folder + '/**/*.html',
css: source_folder + '/scss/**/*.scss',
js: source_folder + '/js/**/*.js',
img: source_folder + '/img/**/*.{jpg,png,svg,gif,icon,webp}'
},
clean: './' + project_folder + '/',
}
let {src, dest} = require('gulp'),
gulp = require('gulp'),
browsersync = require('browser-sync').create(),
fileinclude = require('gulp-file-include'),
del = require('del'),
scss = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
group_media = require('gulp-group-css-media-queries'),
clean_css = require('gulp-clean-css'),
rename = require('gulp-rename');
function browserSync(params) {
browsersync.init({
server:{
baseDir: './' + project_folder + '/'
},
port: 3000,
notify: false
})
}
function html() {
return src(path.src.html)
.pipe(fileinclude())
.pipe(dest(path.build.html))
.pipe(browsersync.stream())
}
function js() {
return src(path.src.js)
.pipe(fileinclude())
.pipe(dest(path.build.js))
.pipe(browsersync.stream())
}
function css() {
return src(path.src.css)
.pipe(
scss({
outputStyle: 'expanded'
})
)
.pipe(group_media())
.pipe(
autoprefixer({
overrideBrowserslist: ['last 5 version'],
cascade: true
})
)
.pipe(dest(path.build.css))
.pipe(clean_css())
.pipe(
rename({
extname: '.min.css'
})
)
.pipe(dest(path.build.css))
.pipe(browsersync.stream())
}
function watchFiles(params) {
gulp.watch([path.watch.html], html);
gulp.watch([path.watch.css], css);
gulp.watch([path.watch.js], js);
}
function clean(params) {
return del(path.clean)
}
let build = gulp.series(clean, gulp.parallel(html, js, css));
let watch = gulp.parallel(build, watchFiles, browserSync);
exports.js = js;
exports.css = css;
exports.html = html;
exports.build = build;
exports.watch = watch;
exports.default = watch;
Полный текс ошибки в терминале
Клик
[sh4rov@keksys gulp-scss-boilerplate]$ gulp js
[23:44:03] Using gulpfile ~/front/gulp-scss-boilerplate/gulpfile.js
[23:44:03] Starting 'js'...
[23:44:03] 'js' errored after 16 ms
[23:44:03] Error: File not found with singular glob: /home/sh4rov/front/gulp-scss-boilerplate/src/js/sctipt.js (if this was purposeful, use `allowEmpty` option)
at Glob.<anonymous> (/home/sh4rov/front/gulp-scss-boilerplate/node_modules/glob-stream/readable.js:84:17)
at Object.onceWrapper (events.js:422:26)
at Glob.emit (events.js:315:20)
at Glob.EventEmitter.emit (domain.js:485:12)
at Glob._finish (/home/sh4rov/front/gulp-scss-boilerplate/node_modules/glob/glob.js:197:8)
at done (/home/sh4rov/front/gulp-scss-boilerplate/node_modules/glob/glob.js:182:14)
at Glob._processSimple2 (/home/sh4rov/front/gulp-scss-boilerplate/node_modules/glob/glob.js:688:12)
at /home/sh4rov/front/gulp-scss-boilerplate/node_modules/glob/glob.js:676:10
at Glob._stat2 (/home/sh4rov/front/gulp-scss-boilerplate/node_modules/glob/glob.js:772:12)
at lstatcb_ (/home/sh4rov/front/gulp-scss-boilerplate/node_modules/glob/glob.js:764:12)
Creates a stream for reading Vinyl objects from the file system.
Note: BOMs (byte order marks) have no purpose in UTF-8 and will be removed from UTF-8 files read by src()
, unless disabled using the removeBOM
option.
Usage#
Signature#
Parameters#
parameter | type | note |
---|---|---|
globs | string array |
Globs to watch on the file system. |
options | object | Detailed in Options below. |
Returns#
A stream that can be used at the beginning or in the middle of a pipeline to add files based on the given globs.
Errors#
When the globs
argument can only match one file (such as foo/bar.js
) and no match is found, throws an error with the message, «File not found with singular glob». To suppress this error, set the allowEmpty
option to true
.
When an invalid glob is given in globs
, throws an error with the message, «Invalid glob argument».
Options#
For options that accept a function, the passed function will be called with each Vinyl object and must return a value of another listed type.
name | type | default | note |
---|---|---|---|
buffer | boolean function |
true | When true, file contents are buffered into memory. If false, the Vinyl object’s contents property will be a paused stream. It may not be possible to buffer the contents of large files.Note: Plugins may not implement support for streaming contents. |
read | boolean function |
true | If false, files will be not be read and their Vinyl objects won’t be writable to disk via .dest() . |
since | date timestamp function |
When set, only creates Vinyl objects for files modified since the specified time. | |
removeBOM | boolean function |
true | When true, removes the BOM from UTF-8 encoded files. If false, ignores a BOM. |
sourcemaps | boolean function |
false | If true, enables sourcemaps support on Vinyl objects created. Loads inline sourcemaps and resolves external sourcemap links. |
resolveSymlinks | boolean function |
true | When true, recursively resolves symbolic links to their targets. If false, preserves the symbolic links and sets the Vinyl object’s symlink property to the original file’s path. |
cwd | string | process.cwd() |
The directory that will be combined with any relative path to form an absolute path. Is ignored for absolute paths. Use to avoid combining globs with path.join() .This option is passed directly to glob-stream. |
base | string | Explicitly set the base property on created Vinyl objects. Detailed in API Concepts.This option is passed directly to glob-stream. |
|
cwdbase | boolean | false | If true, cwd and base options should be aligned.This option is passed directly to glob-stream. |
root | string | The root path that globs are resolved against.This option is passed directly to glob-stream. |
|
allowEmpty | boolean | false | When false, globs which can only match one file (such as foo/bar.js ) causes an error to be thrown if they don’t find a match. If true, suppresses glob failures.This option is passed directly to glob-stream. |
uniqueBy | string function |
'path' |
Remove duplicates from the stream by comparing the string property name or the result of the function. Note: When using a function, the function receives the streamed data (objects containing cwd , base , path properties). |
dot | boolean | false | If true, compare globs against dot files, like .gitignore .This option is passed directly to node-glob. |
silent | boolean | true | When true, suppresses warnings from printing on stderr .Note: This option is passed directly to node-glob but defaulted to true instead of false . |
mark | boolean | false | If true, a / character will be appended to directory matches. Generally not needed because paths are normalized within the pipeline.This option is passed directly to node-glob. |
nosort | boolean | false | If true, disables sorting the glob results. This option is passed directly to node-glob. |
stat | boolean | false | If true, fs.stat() is called on all results. This adds extra overhead and generally should not be used.This option is passed directly to node-glob. |
strict | boolean | false | If true, an error will be thrown if an unexpected problem is encountered while attempting to read a directory. This option is passed directly to node-glob. |
nounique | boolean | false | When false, prevents duplicate files in the result set. This option is passed directly to node-glob. |
debug | boolean | false | If true, debugging information will be logged to the command line. This option is passed directly to node-glob. |
nobrace | boolean | false | If true, avoids expanding brace sets — e.g. {a,b} or {1..3} .This option is passed directly to node-glob. |
noglobstar | boolean | false | If true, treats double-star glob character as single-star glob character. This option is passed directly to node-glob. |
noext | boolean | false | If true, avoids matching extglob patterns — e.g. +(ab) .This option is passed directly to node-glob. |
nocase | boolean | false | If true, performs a case-insensitive match. Note: On case-insensitive file systems, non-magic patterns will match by default. This option is passed directly to node-glob. |
matchBase | boolean | false | If true and globs don’t contain any / characters, traverses all directories and matches that glob — e.g. *.js would be treated as equivalent to **/*.js .This option is passed directly to node-glob. |
nodir | boolean | false | If true, only matches files, not directories. Note: To match only directories, end your glob with a / .This option is passed directly to node-glob. |
ignore | string array |
Globs to exclude from matches. This option is combined with negated globs .Note: These globs are always matched against dot files, regardless of any other settings. This option is passed directly to node-glob. |
|
follow | boolean | false | If true, symlinked directories will be traversed when expanding ** globs.Note: This can cause problems with cyclical links. This option is passed directly to node-glob. |
realpath | boolean | false | If true, fs.realpath() is called on all results. This may result in dangling links.This option is passed directly to node-glob. |
cache | object | A previously generated cache object — avoids some file system calls. This option is passed directly to node-glob. |
|
statCache | object | A previously generated cache of fs.Stat results — avoids some file system calls.This option is passed directly to node-glob. |
|
symlinks | object | A previously generated cache of symbolic links — avoids some file system calls. This option is passed directly to node-glob. |
|
nocomment | boolean | false | When false, treat a # character at the start of a glob as a comment.This option is passed directly to node-glob. |
Sourcemaps#
Sourcemap support is built directly into src()
and dest()
, but is disabled by default. Enable it to produce inline or external sourcemaps.
Inline sourcemaps:
External sourcemaps:
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Closed
salarmehr opened this issue
Sep 14, 2015
· 10 comments
Comments
I’m on version 4 and yet get no notification when there is no corresponding file for a singular glob pattern.
OS Windows 10
CLI version 0.4.0
Node.js v0.10.35
Confirmed:
var gulp = require('gulp'); gulp.task('default', function () { return gulp.src('somefile.txt') .pipe(gulp.dest('someotherfile.txt')); });
Doesn’t throw an error, pretty sure it used to.
I just installed latest gulp 4.0 (both globally and locally) and I get the singular glob error as expected:
Error: File not found with singular glob
My gulp versions:
gulp-testing$ gulp -v
[16:48:03] CLI version 0.4.0
[16:48:03] Local version 4.0.0-alpha.1
And the repo to check it out yourself. Just run gulp test
.
Your repo is working fine for me and throwing the error as expected
@vbud The repo returns a not clear error:
D:labgulpgulp-testing>gulp test
[07:01:12] Using gulpfile D:labgulpgulp-testinggulpfile.js
[07:01:12] Starting 'test'...
[07:01:12] 'test' errored after 21 ms
[07:01:12] Error: File not found with singular glob
at Glob.<anonymous> (D:labgulpgulp-testingnode_modulesgulpnode_modulesvinyl-fsnode_modulesglob-streamindex.js:34:30)
at Glob.emit (events.js:95:17)
at Glob._finish (D:labgulpgulp-testingnode_modulesgulpnode_modulesvinyl-fsnode_modulesglob-streamnode_modulesglobglob.js:172:8)
at done (D:labgulpgulp-testingnode_modulesgulpnode_modulesvinyl-fsnode_modulesglob-streamnode_modulesglobglob.js:159:12)
at Glob._processSimple2 (D:labgulpgulp-testingnode_modulesgulpnode_modulesvinyl-fsnode_modulesglob-streamnode_modulesglobglob.js:652:12)
at D:labgulpgulp-testingnode_modulesgulpnode_modulesvinyl-fsnode_modulesglob-streamnode_modulesglobglob.js:640:10
at Glob._stat2 (D:labgulpgulp-testingnode_modulesgulpnode_modulesvinyl-fsnode_modulesglob-streamnode_modulesglobglob.js:736:12)
at lstatcb_ (D:labgulpgulp-testingnode_modulesgulpnode_modulesvinyl-fsnode_modulesglob-streamnode_modulesglobglob.js:728:12)
at RES (D:labgulpgulp-testingnode_modulesgulpnode_modulesvinyl-fsnode_modulesglob-streamnode_modulesglobnode_modulesinflightinflight.js:23:
at f (D:labgulpgulp-testingnode_modulesgulpnode_modulesvinyl-fsnode_modulesglob-streamnode_modulesglobnode_modulesonceonce.js:17:25)
It does not say which file is not found.
@salarmehr I agree, these error messages could be much more helpful.
It would be helpful to see the glob string for debugging purposes.
Oddly, when I copy exactly same file to my current project and run gulp test
it does not return any error.
the gulp file:
var gulp = require('gulp');
gulp.task('test', function() {
return gulp.src('xasdf.js')
.pipe(gulp.dest('alsonotafile.js'));
});
result:
D:wwwproject>gulp test
[07:27:22] Using gulpfile D:projectgulpfile-.js
[07:27:22] Starting 'test'...
[07:27:22] Finished 'test' after 17 ms
Have you done an npm update
in that project to get the latest state of the gulp 4.0 branch?
doning npm update
now I see the Error: File not found with singular glob
error.
@salarmehr There is actually a change for that in gulpjs/glob-stream@7da2da0 but it hasn’t been versioned and released yet. I am not sure if we can safely bump a patch version due to some other commits.
As it turns out I missed changing file name in HTML file as it was calling main.css instead of style.css.
<!--build:css css/main.min.css -->
<link rel="stylesheet" href="css/main.css">
<!-- endbuild -->
Changed it to:
<!--build:css css/style.min.css -->
<link rel="stylesheet" href="css/style.css">
<!-- endbuild -->
An honest mistake but I believe someone else can run into something similar
Related videos on Youtube
02 : 10
python glob | Files and Folders
03 : 33
Sharepoint: Local gulp not found when executing gulp serve (5 Solutions!!)
06 : 50
Learning Gulp #4 — Watching Files With Gulp
03 : 54
How to solve File Not Found Error FileNotFoundError How To solve Errno 2 No such file or directory
02 : 14
MODULE NOT FOUND — solution on haslips generates image
09 : 15
Iterating through files inside a folder using the glob module in python
01 : 29
[ArcGIS] Sửa lỗi 999999: invalid topology khi chồng lớp (Fix error 999999 while using overlay tool)
01 : 48
GULP doesn’t work. Не работает GULP. HTML CSS
01 : 11
Gulp error (module not found) — NodeJS
01 : 33
Gulp Autoprefixer Not Working — CSS
Comments
-
After renaming my file I am getting the following error when running the gulp build task:
Error: Error: File not found with singular glob: F:ProjectsxyzHTMLappcssmain.css at DestroyableTransform.<anonymous> (F:ProjectsxyzHTMLnode_modulesgulp-usereflibstreamManager.js:90:36)
main.css file no longer exists as I changed it to style.css but for some reason it is searching for the old file.
-
It may be worth noting that if there are any breakages in your less files (e.g. wrong less file reference or incorrect syntax) your generated css won’t be built and thus you’ll also run into the same error.