エラーがgulpウォッチを壊す/クラッシュさせるのを防ぎます
gulp 3.6.2を実行していて、オンラインのサンプルから設定された次のタスクがあります gulp.task('watch', ['default'], function () { gulp.watch([ 'views/**/*.html', 'public/**/*.js', 'public/**/*.css' ], function (event) { return gulp.src(event.path) .pipe(refresh(lrserver)); }); gulp.watch(['./app/**/*.coffee'],['scripts']); gulp.watch('./app/**/*.scss',['scss']); }); CoffeeScriptのgulpウォッチでエラーが発生したときはいつでも停止します。 他の場所で推奨されているように、私はこれを試しました gulp.watch(['./app/**/*.coffee'],['scripts']).on('error', swallowError); gulp.watch('./app/**/*.scss',['scss']).on('error', swallowError); function swallowError (error) { error.end(); } しかし、それは機能していないようです。 何が悪いのですか? @Aperçuの回答に応じて、私は自分のswallowError方法を変更し、代わりに次のことを試しました: gulp.task('scripts', function () { gulp.src('./app/script/*.coffee') .pipe(coffee({ bare: true })) .pipe(gulp.dest('./public/js')) .on('error', swallowError); }); …