[英]Gulp-Notify Error - dest.on is not a function
I am trying to use Gulp-Notify's error handling function, but I keep getting the following error:我正在尝试使用 Gulp-Notify 的错误处理功能,但我不断收到以下错误:
TypeError: dest.on is not a function
I am following the instructions here: https://www.npmjs.com/package/gulp-notify#notifyonerror but keep getting the same error.我正在按照此处的说明进行操作: https : //www.npmjs.com/package/gulp-notify#notifyonerror但不断收到相同的错误。
Here is my file:这是我的文件:
const gulp = require('gulp');
const rename = require('gulp-rename');
const sass = require('gulp-sass');
const cleancss = require('gulp-clean-css');
var plumber = require("gulp-plumber");
var through = require('gulp-through');
var notify = require("gulp-notify");
gulp.task('styles', function(){
gulp.src('builders/stylesheets/style.scss')
.pipe(sass())
.pipe(cleancss())
.pipe(rename('style.min.css'))
.pipe(gulp.dest('assets/css'))
.pipe(notify("Saved Styles!"))
.pipe(plumber({errorHandler: notify.onError("Error: <%= error.message %>")}))
.pipe(through(function () {
this.emit("error", new Error("Something happend: Error message!"))
}));
});
Any idea what it could be?知道它可能是什么吗?
I appreciate any of the help!我感谢任何帮助!
Thanks!谢谢!
Brad布拉德
Tested your task and the error comes from your through
and not from the notify
.测试了您的任务,错误来自您的
through
而不是来自notify
。
If you delete this pipe it runs without problems.如果您删除此管道,它会毫无问题地运行。 The gulp-through documentation shows an example, but i couldn't find there a usecase with
pipe
. gulp-through 文档显示了一个示例,但我找不到带有
pipe
用例。
gulp.task('styles', function(cb){
gulp.src('builders/stylesheets/style.scss')
.pipe(sass())
.pipe(cleancss())
.pipe(rename('style.min.css'))
.pipe(gulp.dest('assets/css'))
.pipe(notify("Saved Styles!"))
.pipe(plumber({errorHandler: notify.onError("Error: <%= error.message %>")}))
cb();
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.