gulp-watch: Error: pass strings or arrays of strings

I have this watch task that keeps failing after I updated the from v1 to the latest vid.

//Run task runner on any change or new file
gulp.task('watch',function(){
    $.watch(['app/**/*'],function(files,cb){
        gulp.start('default', cb);
    })
})

Error:

PS C:\Users\Administrator\Dropbox\projects\spDash> gulp watch
[16:23:04] Using gulpfile ~\Dropbox\projects\spDash\gulpfile.js
[16:23:04] Starting 'watch'...
[16:23:04] Finished 'watch' after 84 ms
C:\Users\Administrator\Dropbox\projects\spDash\node_modules\gulp\node_modules\orchestrator\index.js:89
                                        throw new Error('pass strings or arrays of strings');
                                        ^

Error: pass strings or arrays of strings
    at Gulp.Orchestrator.start (C:\Users\Administrator\Dropbox\projects\spDash\node_modules\gulp\node_modules\orchestrator\index.js:89:12)
    at C:\Users\Administrator\Dropbox\projects\spDash\gulpfile.js:316:18
    at write (C:\Users\Administrator\Dropbox\projects\spDash\node_modules\gulp-watch\index.js:123:9)
    at C:\Users\Administrator\Dropbox\projects\spDash\node_modules\gulp-watch\node_modules\vinyl-file\index.js:52:4
    at C:\Users\Administrator\Dropbox\projects\spDash\node_modules\gulp-watch\node_modules\vinyl-file\node_modules\graceful-fs\graceful-fs.js:76:16
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 20

Most upvoted comments

Ooops, I just did it piping to another process now. I can reproduce the error now, but it is actually different from the error reported here. ๐Ÿ˜›

As far as I can tell, the error is not related to gulp-watch. The issue is curious, though.

@jonschlinkert Sure, thanks. ๐Ÿ˜„ The repository needs some housekeeping (documentation can be improved, tests need to be fixed, issues to triage and close), but I have very little time currently.

In the latest version, the callback no longer receives a callback argument.

Thatโ€™s because gulp-batch has been decoupled from the core, but you can easily re-add it:

npm i -D gulp-batch
// Run task runner on any change or new file
gulp.task('watch', function() {
    $.watch(['app/**/*'], $.batch(function(files, cb) {
        gulp.start('default', cb);
    }));
});