Gulp无法正常工作。 AssertionError [ERR_ASSERTION]:

时间:2019-11-12 19:28:19

标签: gulp gulp-watch gulp-sass gulp-concat

enter image description here

package.json

{
  "name": "project",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Afina",
  "license": "ISC",
  "devDependencies": {
    "browser-sync": "^2.26.7",
    "gulp": "^4.0.2",
    "gulp-concat-css": "^3.1.0",
    "gulp-sass": "^4.0.2",
    "gulp-sourcemaps": "^2.6.5",
    "node-sass": "^4.13.0",
    "sass": "^1.23.3"
  }
}

gulfile.js

 

var gulp= require('gulp');
var browserSync = require('browser-sync').create();
var sass = require('gulp-sass');
var concatCss=require('gulp-concat-css');

gulp.task('serve', ['sass'], function(){
  browserSync.init({
  server: {
  baseDir: "./src"
 }      
 });
gulp.watch("src/sass/**/*.sass", ['sass']);
 gulp.watch("src/*.html").on('change', browserSync.reload);
})


gulp.task('sass', function() {
 return gulp.src("src/sass/**/.sass")
 .pipe(sass())
 .pipe(concatCss("main.css"))
 .pipe(gulp.dest("src/css"))
 .pipe(browserSync.stream());

}); 

运行gulp时出现此错误。为什么显示此错误?

  

PS C:...... \工程>       assert.js:378   犯错   ^   在Gulp.set [作为_setTask](C:............... \ project \ node_modules \ undertaker \ lib \ set-task.js:10:3​​)   在Gulp.task(C:............... \ project \ node_modules \ undertaker \ lib \ task.js:13:8)   在对象。 (C:............... \ project \ gulpfile.js:22:6)   在Module._compile(内部/模块/cjs/loader.js:1063:30)   在Object.Module._extensions..js(internal / modules / cjs / loader.js:1103:10)   在Module.load(internal / modules / cjs / loader.js:914:32)   在Function.Module._load(internal / modules / cjs / loader.js:822:14)   在Module.require(internal / modules / cjs / loader.js:956:19)   在要求时(内部/模块/cjs/helpers.js:74:18)   在执行时(C:............ \ npm \ node_modules \ gulp-cli \ lib \ versioned \ ^ 4.0.0 \ index.js:36:18)   {   generateMessage:否,   代码:“ ERR_ASSERTION”,   实际:错误,   预期:是的,   运算子:'=='   }

0 个答案:

没有答案