简体   繁体   English

Gulp 错误:以下任务未完成:默认,sass

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

I have created a gulpfile.js file for a project I'm building.我为我正在构建的项目创建了一个 gulpfile.js 文件。 When I try to run it, I get this error.当我尝试运行它时,我得到了这个错误。

[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?

Here is my gulpfile.js code这是我的 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
});

Also, you will want to switch to the plugin gulp-dart-sass instead of gulp-sass .此外,您需要切换到插件gulp-dart-sass而不是gulp-sass It supports more recent features like @use for example.它支持更新的功能,例如@use

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Gulp 错误:“以下任务未完成;您是否忘记发出异步完成信号” - Gulp Error: "The following tasks did not complete; Did you forget to signal async completion" 我如何解决此错误'以下任务未完成:默认,您是否忘记了异步完成信号? ' - how can i solve this error 'The following tasks did not complete: default, Did you forget to signal async completion? ' Gulp 4.浏览器同步问题//以下任务未完成:浏览器同步 - Gulp 4. The problem with browser-sync // The following tasks did not complete: browser-sync Gulp4 - 任务没有完成,忘记发信号异步完成 - Gulp4 - tasks did not complete and forget to signal async completion Gulp-ruby-sass错误: - Gulp-ruby-sass Error : WebStorm中的Gulp错误:无法列出gulp任务 - Gulp error in WebStorm: Failed to list gulp tasks 只有在所有默认项都无误通过后,才能运行Gulp任务吗? - How can I run Gulp tasks only after all of the default items pass with no error? 在gulp中使用默认任务时出现错误,在Gitbash中显示以下错误:任务需要一个字符串名称 - Getting error when using default task in gulp, shows the following error in Gitbash : Task requires a name that is string 安装时出现gulp-sass错误 - gulp-sass error when installing 内部错误:无效的UTF-8 - Sass&Gulp - Internal Error: Invalid UTF-8 - Sass & Gulp
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM