AssertionError [ERR_ASSERTION]:必须指定任务功能GULP(节点js,梯形失真js)

时间:2019-10-22 06:58:47

标签: javascript node.js gulp keystonejs

我不知道为什么收到此错误AssertionError [ERR_ASSERTION]:必须指定任务功能GULP(节点js,梯形js)。是什么导致此错误?任何人都可以帮忙吗?我正在使用Keystone应用程序和Sass编译吗? gulp文件,它将重新启动keystonejs应用程序并编译sass。这是关于gulp版本的问题吗,我package.json中的目标版本是“ gulp”:“ ^ 4.0.2”,。

我的Gulp文件

  var gulp = require('gulp');
var jshint = require('gulp-jshint');
var jshintReporter = require('jshint-stylish');
var watch = require('gulp-watch');
var sass = require('gulp-sass');
var shell = require('gulp-shell')
var bs = require('browser-sync').create();


var paths = {
    'src':['./models/**/*.js','./routes/**/*.js', 'keystone.js', 'package.json'],
    'style': {
        all: './public/styles/**/*.scss',
        output: './public/styles/'
    }
};

// gulp lint
gulp.task('lint', function(){
    gulp.src(paths.src)
        .pipe(jshint())
        .pipe(jshint.reporter(jshintReporter));
});

// gulp watcher for lint
gulp.task('watch:lint', function () {
    gulp.src(paths.src)
        .pipe(watch())
        .pipe(jshint())
        .pipe(jshint.reporter(jshintReporter));
});

gulp.task('sass', function(){
    gulp.src(paths.style.all)
        .pipe(sass().on('error', sass.logError))
        .pipe(gulp.dest(paths.style.output))
    .pipe(bs.stream());
});

gulp.task('watch:sass', function () {
    gulp.watch(paths.style.all, ['sass']);
});

gulp.task('browser-sync', function(){
  bs.init({
    proxy: 'http://localhost:3000',
    port: '4000'
  });
});

gulp.task('runKeystone', shell.task('node keystone.js'));

gulp.task('watch', ['watch:sass', 'watch:lint']);
gulp.task('default', ['watch', 'runKeystone', 'browser-sync']);

0 个答案:

没有答案