Fixing gulp-include error of “no files found matching…” when the file exists

In using gulp to include files inline I ran into a bit of an error. gulp-include kept throwing the following error:

WARN: gulp-include – no files found matching [file_path_here]

These types of errors drive me crazy. The file was exactly where it was supposed to be. I checked it several times. What gives?! Turns out, gulp-include feels that finishing the include line with a semicolon is a deadly sin.

// remove the ending semicolon from include #include "lower_third_module"

Changing all includes to remove the semicolon did the trick. Here’s the gulp file for reference.

const gulp = require('gulp'); const replace = require('gulp-replace'); const include = require('gulp-include'); gulp.task("myTask", function() { gulp.src("src/lower_third_script.jsx") .pipe(replace("#include", "//=include")) .pipe(include()) .on('error', console.log) .pipe(gulp.dest("dist")); });

If you found this article, hopefully it will help you. Happy typing.