简体   繁体   中英

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

This is my 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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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