generator-polymer-init-custom-build icon indicating copy to clipboard operation
generator-polymer-init-custom-build copied to clipboard

writer after end error with gulp.watch

Open timeu opened this issue 8 years ago • 7 comments

Somehow I run into an error when I try to add a gulp.swatch to the gulpfile.js.

Steps to reproduce:

  1. scaffold project
  2. add to the gulpfile.js:
gulp.task('watch',gulp.series('default',function() {
  const watcher = gulp.watch('src/**/*.html');
  watcher.on('all',gulp.series(['default']));
}));
  1. run gulp watch
  2. modify src/my-app.html file
  3. gulp.watch crashes with this error log:
[10:44:36] Starting 'watch'...
[10:44:36] Starting 'default'...
[10:44:36] Starting 'clean'...
[10:44:36] Finished 'clean' after 12 ms
[10:44:36] Starting 'output'...
[10:44:39] gulp-imagemin: Minified 6 images (saved 9.54 kB - 24.1%)
[10:44:42] Finished 'output' after 6.59 s
[10:44:42] Starting 'serviceWorker'...
[10:44:42] Finished 'serviceWorker' after 139 ms
[10:44:42] Finished 'default' after 6.74 s
[10:44:42] Starting '<anonymous>'...
[10:44:51] Starting 'default'...
[10:44:51] Starting 'clean'...
[10:44:51] Finished 'clean' after 191 ms
[10:44:51] Starting 'output'...
[10:44:51] Finished 'output' after 16 ms
[10:44:51] Starting 'serviceWorker'...
[10:44:51] 'serviceWorker' errored after 36 ms
[10:44:51] Error: ENOENT: no such file or directory, open 'build/bundled/service-worker.js'
    at Error (native)
[10:44:51] 'default' errored after 248 ms
error:    Error: write after end
    at writeAfterEnd (_stream_writable.js:166:12)
    at StreamAnalyzer.Writable.write (_stream_writable.js:217:5)

timeu avatar Sep 01 '16 08:09 timeu

I am having the same issue, feelsbadman. If someone has any clue about this please consider sharing it.

willydouhard avatar Oct 10 '16 13:10 willydouhard

Can confirm. I did a simplified gulp watch:

gulp.task('watch', function () {
  gulp.watch('src/**/*.html', gulp.series('default'));
});

And I get the same error when it runs the 2nd time. My hunch is maybe this line is getting the incorrect path. Might suggest using gutil to log it. Not sure if I'll be able to get to this before the Summit next week

robdodson avatar Oct 10 '16 16:10 robdodson

@robdodson any updates on this?

bm2u avatar Aug 08 '17 07:08 bm2u

@bm2u no unfortunately I haven't had much time to look into it. I'd welcome any help to try to debug it :)

robdodson avatar Aug 08 '17 15:08 robdodson

This might help at least some people (who are using gulp-filter), who landed in this thread googling the error: https://stackoverflow.com/a/29617943/2477364

Neonit avatar Oct 16 '17 08:10 Neonit

This remains a problem, and makes this tool unusable for us, even in a very minimalist, simplified app.

teddyward avatar Apr 13 '18 18:04 teddyward

@teddyward I'd suggest using Polymer CLI if possible. I don't think anyone is able to maintain this generator.

robdodson avatar Apr 13 '18 21:04 robdodson