Gulp突然停止了与BrowserSync的合作。 node_modules / glob-watcher上的RangeError

我正在运行Gulp的问题。 一切工作完美,但我今天来运行它,当我运行我的任务运行BrowserSync服务器,代理MAMP我得到以下错误。

Using gulpfile ~/Web Development/MAMP Server/Portfolio/gulpfile.js [20:18:33] Starting 'watchSass'... [20:18:33] Finished 'watchSass' after 13 ms [20:18:33] Starting 'serve'... [20:18:57] 'serve' errored after 24 s [20:18:57] RangeError: Maximum call stack size exceeded at Gaze._pollFile (/Users/thomashughes/Web Development/MAMP Server/Portfolio/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:331:19) at /Users/thomashughes/Web Development/MAMP Server/Portfolio/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:411:12 at Array.forEach (native) at /Users/thomashughes/Web Development/MAMP Server/Portfolio/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:409:11 at iterate (/Users/thomashughes/Web Development/MAMP Server/Portfolio/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/helper.js:52:5) at /Users/thomashughes/Web Development/MAMP Server/Portfolio/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/helper.js:61:11 at /Users/thomashughes/Web Development/MAMP Server/Portfolio/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:420:5 at iterate (/Users/thomashughes/Web Development/MAMP Server/Portfolio/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/helper.js:52:5) at /Users/thomashughes/Web Development/MAMP Server/Portfolio/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/helper.js:61:11 at /Users/thomashughes/Web Development/MAMP Server/Portfolio/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:420:5 [BS] Proxying: http://localhost [BS] Access URLs: ------------------------------------ Local: http://localhost:3000 External: http://192.168.0.3:3000 ------------------------------------ UI: http://localhost:3001 UI External: http://192.168.0.3:3001 

然后它将观看和编译Sass,但不能用BrowserSync重新载入我的浏览器。

我该如何解决这个问题,到目前为止它已经工作得很好,如果这样做有区别,我就在Mac上。

我的gulpfile.js如下所示:

 var gulp = require('gulp'), sass = require('gulp-sass'), browserSync = require('browser-sync'), autoprefixer = require('gulp-autoprefixer'), cssnano = require('gulp-cssnano'), imagemin = require('gulp-imagemin'); // Development Tasks gulp.task('watchSass', function() { gulp.watch('app/sass/**/*.scss', ['compileSass']); }) gulp.task('compileSass', function(){ //Task to compile Sass into CSS return gulp.src("app/sass/main.scss") .pipe(sass({outputStyle: 'expanded'}).on('error', sass.logError)) .pipe(autoprefixer()) .pipe(gulp.dest('app/css')); }); gulp.task('serve', ['watchSass'], function() { browserSync.init({ //server: "app/." For static websites proxy: "localhost" //Takes us to MAMP localhost where we can select project folder }); gulp.watch(['**/*.*']).on('change', browserSync.reload); }); // Build Tasks gulp.task('move', function(){ return gulp.src(["app/*.html", "app/*.php" , "app/css/main.css", "app/img/**.*", "app/js/**.js"], {base:'app'}) .pipe(gulp.dest('dist')); }); gulp.task('minifyImages', ['move'], function(){ return gulp.src('dist/img/**.*') .pipe(imagemin()) .pipe(gulp.dest('dist/img')); }); gulp.task('minifyCss', ['move'], function(){ return gulp.src('dist/css/main.css') .pipe(cssnano()) .pipe(gulp.dest('dist/css')); }); // Gulp Commands gulp.task('dev', ['serve']) gulp.task('default', ['dev']); gulp.task('build', ['minifyCss', 'minifyImages']);