I'm trying to match all subdirectories of a given directory.
I want to match all .js files inside subdirectories:
/path/to/dir/dir1/*.js
/path/to/dir/dir2/dir3/*.js
/path/to/dir/dir4/*.js
While excluding:
/path/to/dir/
I'm using the following pattern:
/path/to/dir/**/*.js
When I run the gulp task, I get the following error:
Unable to find local gulp. Try running 'npm install gulp' /path/to/dir/.
Shouldn't /path/to/dir/ be excluded by the given pattern? Why is it looking for gulp on a directory that I don't want to be matched?
Thanks in advance!
path/to/dir/**/*.js does include path/to/dir/*.js, because **/ means "zero or more directories".
I'm not sure if that's anything to do with your problem though, because it sounds like gulp isn't even starting... That message means the global gulp CLI ran, but it couldn't find a local copy of gulp in your current project. Make sure you're in the root of your project (where your gulpfile is), and then run gulp. And if you still get "Unable to find local gulp", then install it locally with npm install gulp --save.
You need to follow the instructions here https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md
For future reference questions like this belong on StackOverflow.
Most helpful comment
path/to/dir/**/*.jsdoes includepath/to/dir/*.js, because**/means "zero or more directories".I'm not sure if that's anything to do with your problem though, because it sounds like gulp isn't even starting... That message means the global gulp CLI ran, but it couldn't find a local copy of gulp in your current project. Make sure you're in the root of your project (where your gulpfile is), and then run
gulp. And if you still get "Unable to find local gulp", then install it locally withnpm install gulp --save.