简体   繁体   English

gulp错误-使用gulp.watch时_.flattenDeep不是函数

[英]gulp error - _.flattenDeep is not a function when using gulp.watch

Why do I get TypeError: _.flattenDeep is not a function when I run a watch task 为什么出现TypeError: _.flattenDeep is not a function运行监视任务时TypeError: _.flattenDeep is not a function

This is my gulpfile.js : 这是我的gulpfile.js:

var gulp = require('gulp');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var autoprefixer = require('gulp-autoprefixer');
var cleanCSS = require('gulp-clean-css');



gulp.task('css', function(){
    gulp.src('public/sass2/**/*.scss')
    .pipe(sourcemaps.init())
    .pipe(sass())
    .pipe(sourcemaps.write())
    .pipe(autoprefixer())
    .pipe(gulp.dest('public/css'))
});

gulp.task('default', function() {
    gulp.watch('public/sass2/**/*.scss', ['css']);
});

I'm always getting this error when using the watch task, how do I get passed it? 使用watch任务时总是出现此错误,我该如何传递它?

尝试在项目npm i --save lodash安装lodash-- npm i --save lodash

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM