找不到模块&gulp-watch'错误抛出

时间:2017-09-03 09:37:44

标签: javascript wordpress gulp gulp-watch

错误当我运行gulp时无法找到模块&gulp-watch' 。有什么不对?

我正确安装了gulp

npm rm --global gulp
npm install --global gulp-cli
npm init 
npm install --save-dev gulp

我创建了这个gulpfile.js

var gulp = require('gulp'), watch = require('gulp-watch');
var cssnano = require('gulp-cssnano');
var pump = require('pump');
var uglify = require('gulp-uglify');
var sass = require('gulp-sass');
// var htmlmin = require('gulp-htmlmin');

//Watch
gulp.task('stream', function () {
    // Endless stream mode 
    // gulp.watch('./css/*.scss', ['minifyHTML']);
    gulp.watch( 'assets/css/*.scss', ['styles']);
    gulp.watch( 'assets/js/*.js', ['scripts']);
    return watch('./css', { ignoreInitial: false })
        .pipe(gulp.dest('.'));
});

//bla bla (the rest)

1 个答案:

答案 0 :(得分:2)

watch = require('gulp-watch');需要此模块...
您需要安装它:npm install --save-dev gulp-watch