Skip to content
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

Handling gulp.watch errors in Gulp 4 #848

Closed
demisx opened this issue Jan 3, 2015 · 5 comments
Closed

Handling gulp.watch errors in Gulp 4 #848

demisx opened this issue Jan 3, 2015 · 5 comments

Comments

@demisx
Copy link
Contributor

demisx commented Jan 3, 2015

I have this task watching various code paths in G4:

gulp.task('watch:code', function () {
  gulp.watch([
    paths.html,
    paths.js,
    paths.images,
    paths.json,
    paths.vendor.bower.js,
    paths.vendor.bower.css,
  ], gulp.series('build', browserSync.reload));
});

Each time I move files around in one of those directories gulp.watch crashes with this error:

Error: ENOENT, no such file or directory '/Users/dmoore/projects/dimaslist/dimaslist-org-desktop/app/components/_mocks/untitled folder/'
  at Object.fs.readdirSync (fs.js:665:18)
  at Gaze._addToWatched (/Users/dmoore/projects/dimaslist/dimaslist-org-desktop/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:274:22)
  at Gaze._internalAdd (/Users/dmoore/projects/dimaslist/dimaslist-org-desktop/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:191:10)
  at /Users/dmoore/projects/dimaslist/dimaslist-org-desktop/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:400:16
  at Array.forEach (native)
  at /Users/dmoore/projects/dimaslist/dimaslist-org-desktop/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:396:12

Can you guys please point me in the right direction on what would be the proper way to handle gulp.watch errors in Gulp 4? Basically, I just want to write the error to the console without gulp.watch crashing each time. Thank you.

@ilanbiala
Copy link

@demisx I think this will be debated more in #359. You should just close this because it's pretty much a dupe and subscribe to that issue.

@demisx
Copy link
Contributor Author

demisx commented Jan 3, 2015

@ilanbiala Sure, but my only concern is that #359 hasn't been updated since August 26 and gulp.watch crash affects us every day. I am wondering maybe the core guys can suggest a way or a workaround we could use now until the official documentation is ready.

@ilanbiala
Copy link

It's better to ask about it there, where others will get notified about it.

@yocontra
Copy link
Member

yocontra commented Jan 4, 2015

This is a bug in gaze, the library responsible for file watching. I understand that bugs in that library are a pain in the ass but I have never touched that code base before and we're at the mercy of that author to fix these bugs. See #651 where all watch bugs are being pooled for now. Supposedly a new version of gaze is coming out that will solve these, but it has been months and no progress.

@yocontra yocontra closed this as completed Jan 4, 2015
@demisx
Copy link
Contributor Author

demisx commented Jan 4, 2015

@contra Thank you for clarification. I'll bug the gaze now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants