簡體   English   中英

Gulp 錯誤:以下任務未完成:默認,sass

[英]Gulp error: The following tasks did not complete: default, sass

我為我正在構建的項目創建了一個 gulpfile.js 文件。 當我嘗試運行它時,我得到了這個錯誤。

[18:29:03] Using gulpfile ~\Documents\codeprojects\antenna\gulpfile.js
[18:29:03] Starting 'default'...
[18:29:03] Starting 'sass'...
[18:29:03] The following tasks did not complete: default, sass
[18:29:03] Did you forget to signal async completion?

這是我的 gulpfile.js 代碼

var gulp = require('gulp');
var sass = require('gulp-sass');
var plumber = require('gulp-plumber');

gulp.task('sass', function() {
    gulp.src('public/stylesheets/style.scss')
      .pipe(plumber())
      .pipe(sass())
      .pipe(gulp.dest('public/stylesheets'));
});

gulp.task('watch', function() {
    gulp.watch('public/stylesheets/*.scss', ['sass']);
});

gulp.task('default', gulp.series('sass', 'watch'));
gulp.task('sass', function() {
    return gulp.src('public/stylesheets/style.scss')  // return added here
      .pipe(plumber())
      .pipe(sass())
      .pipe(gulp.dest('public/stylesheets'));
});

// the return above will suffice to "signal async completion"

gulp.task('watch', function() {
    // gulp.watch('public/stylesheets/*.scss', ['sass']);  // old gulp v3 synatx
    gulp.watch('public/stylesheets/*.scss', gulp.series('sass'));  // v4 syntax
});

此外,您需要切換到插件gulp-dart-sass而不是gulp-sass 它支持更新的功能,例如@use

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM