Сам код ошибки
$ gulp watch
[10:23:08] Using gulpfile ~\gulpfile.js
[10:23:08] Starting 'watch'...
[10:23:08] 'watch' errored after 6.21 ms
[10:23:08] TypeError: Cannot read property '0' of undefined
at resolveGlob (C:\Users\kotov\node_modules\gulp-watch\index.js:45:11)
at Array.map (native)
at module.exports (C:\Users\kotov\node_modules\gulp-watch\index.js:56:16)
at Gulp.<anonymous> (C:\Users\kotov\gulpfile.js:109:5)
at module.exports (C:\Users\kotov\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:34:7)
at Gulp.Orchestrator._runTask (C:\Users\kotov\node_modules\gulp\node_modules\orchestrator\index.js:273:3)
at Gulp.Orchestrator._runStep (C:\Users\kotov\node_modules\gulp\node_modules\orchestrator\index.js:214:10)
at Gulp.Orchestrator.start (C:\Users\kotov\node_modules\gulp\node_modules\orchestrator\index.js:134:8)
at C:\Users\kotov\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:129:20
at nextTickCallbackWith0Args (node.js:420:9)
Сам gulpfile
'use strict';
var gulp = require('gulp'),
watch = require('gulp-watch'),
concat = require('gulp-concat'),
less = require('gulp-less'),
csscomb = require('gulp-csscomb'),
auto = require('gulp-autoprefixer'),
svgstore = require('gulp-svgstore'),
cheerio = require('gulp-cheerio'),
svgmin = require('gulp-svgmin'),
imagemin = require('gulp-imagemin'),
pngquant = require('imagemin-pngquant'),
uglify = require('gulp-uglify'),
notify = require("gulp-notify"),
fileinclude = require('gulp-file-include'),
cssmin = require('gulp-cssmin');
var path = {
build: { //Тут мы укажем куда складывать готовые после сборки файлы
html: 'Проекты/ArteLamp/prod/',
js: 'Проекты/ArteLamp/prod/js/',
css: 'Проекты/ArteLamp/prod/css/',
img: 'Проекты/ArteLamp/prod/img/'
},
src: { //Пути откуда брать исходники
html: 'Проекты/ArteLamp/dev/*.html',
style: 'Проекты/ArteLamp/dev/css/**/*.less',
img: 'Проекты/ArteLamp/dev/img/*.png',
js: 'git/ArteLamp/js/*.js'
},
watch: { //Тут мы укажем, за изменением каких файлов мы хотим наблюдать
html: 'Проекты/ArteLamp/dev/**/*.html',
style: 'Проекты/ArteLamp/dev/css/*.less',
javascript: 'Проекты/ArteLamp/dev/js/*.js',
img: 'Проекты/ArteLamp/dev/img/*.png'
}
};
gulp.task('js:build', function() {
return gulp.src(path.src.js)
.pipe(concat('app.js'))
.pipe(uglify())
.pipe(gulp.dest(path.build.js))
.pipe(notify("js готов"));
});
gulp.task('js2:build', function() {
return gulp.src('Проекты/ArteLamp/dev/js/lib/*.js')
.pipe(concat('libs.js'))
.pipe(uglify())
.pipe(gulp.dest(path.build.js))
.pipe(notify("общий js готов"));
});
gulp.task('svg', function() {
return gulp.src('Проекты/ArteLamp/dev/img/svg/*.svg')
.pipe(svgmin())
.pipe(svgstore())
.pipe(cheerio({
parserOptions: {
xmlMode: true
}
}))
.pipe(gulp.dest(path.build.img));
});
gulp.task('style:build', function () {
return gulp.src('Проекты/ArteLamp/dev/css/lib/*.css')
.pipe(concat('libs.css'))
.pipe(cssmin())
.pipe(gulp.dest(path.build.css))
.pipe(notify("общий css готов"));
});
gulp.task('style2:build', function () {
return gulp.src(path.src.style)
.pipe(concat('styles.css'))
.pipe(less())
.pipe(csscomb())
.pipe(auto())
.pipe(gulp.dest(path.build.css))
.pipe(notify("css готов"));
});
gulp.task('html:build', function() {
return gulp.src(path.src.html)
.pipe(fileinclude({
prefix: '@@',
basepath: 'Проекты/ArteLamp/dev/templates/'
}))
.pipe(gulp.dest(path.build.html));
});
gulp.task('image:build', function () {
return gulp.src(path.src.img)
.pipe(imagemin({
progressive: true,
use: [pngquant()],
interlaced: true
}))
.pipe(gulp.dest(path.build.img));
});
gulp.task('build', [
'image:build',
'style2:build',
'html:build',
'style:build',
'js:build',
'js2:build'
]);
gulp.task('default', ['build']);
gulp.task('watch', function(){
watch([path.watch.html], function(event, cb) {
gulp.start('html:build');
});
watch([path.watch.complex], function(event, cb) {
gulp.start('style2:build');
});
watch([path.watch.complex], function(event, cb) {
gulp.start('style:build');
});
watch([path.watch.img], function(event, cb) {
gulp.start('image:build');
});
watch([path.watch.javascript], function(event, cb) {
gulp.start('js:build');
});
watch([path.watch.javascript], function(event, cb) {
gulp.start('js2:build');
});
});