指定要监视的文件时,browser-sync崩溃

时间:2016-08-30 14:30:55

标签: javascript gulp browser-sync

我正在尝试使用browser-sync来处理我的Flask项目。我的gulpfile.js看起来像这样:

var gulp = require('gulp');
var bs = require('browser-sync').create();
var exec = require('child_process').exec;
var browserSync = require('browser-sync');


gulp.task('preload', function() {});

gulp.task('run-server', function() {
    var proc = exec('python3 run.py');
});

gulp.task('default', ['preload', 'run-server'], function() {
    browserSync({
        notify: false,
        proxy: '0.0.0.0:5000',
        files: [
            "web/templates/*.html"
        ],
        port: 7000
    });
});

我在html数组中指定要查看的files文件的路径。当我运行它时,我收到此错误:

[15:26:18] Using gulpfile ~/Learning/vision-boilerplate/gulpfile.js
[15:26:18] Starting 'preload'...
[15:26:18] Finished 'preload' after 30 μs
[15:26:18] Starting 'run-server'...
[15:26:18] Finished 'run-server' after 3.6 ms
[15:26:18] Starting 'default'...
[15:26:18] Finished 'default' after 14 ms

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: watch ENOSPC
    at errnoException (fs.js:1024:11)
    at FSWatcher.start (fs.js:1056:11)
    at Object.fs.watch (fs.js:1081:11)
    at createFsWatchInstance (/home/user/Learning/vision-boilerplate/node_modules/browser-sync/node_modules/chokidar/lib/nodefs-handler.js:37:15)
    at setFsWatchListener (/home/user/Learning/vision-boilerplate/node_modules/browser-sync/node_modules/chokidar/lib/nodefs-handler.js:80:15)
    at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/user/Learning/vision-boilerplate/node_modules/browser-sync/node_modules/chokidar/lib/nodefs-handler.js:228:14)
    at FSWatcher.NodeFsHandler._handleDir (/home/user/Learning/vision-boilerplate/node_modules/browser-sync/node_modules/chokidar/lib/nodefs-handler.js:407:19)
    at FSWatcher.<anonymous> (/home/user/Learning/vision-boilerplate/node_modules/browser-sync/node_modules/chokidar/lib/nodefs-handler.js:455:19)
    at FSWatcher.<anonymous> (/home/user/Learning/vision-boilerplate/node_modules/browser-sync/node_modules/chokidar/lib/nodefs-handler.js:460:16)
    at Object.oncomplete (fs.js:107:15)

如果我从files参数中省略browserSync数组,那么一切正常(当然,它不会在对html文件的更改时重新加载。)

0 个答案:

没有答案