«TypeError: dest.on не является функцией» в Gulp-Watch - PullRequest
0 голосов
/ 16 апреля 2019

Я получаю следующую ошибку, когда запускаю gulp-watch и сохраняю изменения в моем html-файле.

[16:07:41] Starting 'html'...
[16:07:41] 'html' errored after 3.37 ms
[16:07:41] TypeError: dest.on is not a function
    at DestroyableTransform.Readable.pipe (/Users/Joe/Desktop/WEBSITE BUILDING/PROJECTS/_4. La Gran Chocolo/LGC Website/node_modules/readable-stream/lib/_stream_readable.js:564:8)
    at pipe (/Users/Joe/Desktop/WEBSITE BUILDING/PROJECTS/_4. La Gran Chocolo/LGC Website/gulp/tasks/watch.js:49:6)
    at bound (domain.js:395:14)
    at runBound (domain.js:408:12)
    at asyncRunner (/Users/Joe/Desktop/WEBSITE BUILDING/PROJECTS/_4. La Gran Chocolo/LGC Website/node_modules/async-done/index.js:55:18)
    at process._tickCallback (internal/process/next_tick.js:61:11)

Любая помощь сильно оценена.Вот код из моего файла gulp:

import gulp from "gulp";
import watch from "gulp-watch";
import browserSync from "browser-sync";
import plumber from "gulp-plumber";

var watchHtml = "./app/index.html",
  destRoot = "./dest/",

const server = browserSync.create();

function cb(done) {
  done();
}

function html() {
  browserSync.reload();
  return gulp
    .src(watchHtml)
    .pipe(plumber)
    .pipe(gulp.dest(destRoot));
}

function watch_files(done) {
  browserSync.init({
    server: {
      baseDir: "app"
    }
  });
  gulp.watch(watchHtml, html);
  done();
}

//===========Execute Functions==========//

gulp.task("cssInject", gulp.series(styles, cssInject));

gulp.task("styles", styles);

gulp.task("html", html);

gulp.task("watch", watch_files);

Browsersync работает, но файлы не попадают в целевые папки, и я получаю эту ошибку.

...