gulp watch throws error错误:观看

时间:2018-05-03 09:06:29

标签: gulp gulp-watch

最近我收到了gulp watch的错误,我用Google搜索并试图解决这个问题,但是没有用。任何人都知道任何具体原因吗?

App基于AngulerJs 1.3并在npm 5.7.1 / node v6.9.5 Ubuntu 16.04上运行

我在几个月前遇到了同样的问题,当时很难解决问题,然后问题自我消失或至少我没有任何线索如何。

错误输出:

Error: watch /home/demo/project/web/admin/src/css ENOSPC
at exports._errnoException (util.js:1022:11)
at FSWatcher.start (fs.js:1429:19)
at Object.fs.watch (fs.js:1456:11)
at createFsWatchInstance 
(/home/demo/project/web/admin/node_modules/chokidar/lib/nodefs-handler.js:37:15)
at setFsWatchListener 
(/home/demo/project/web/admin/node_modules/chokidar/lib/nodefs-handler.js:80:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs 
(/home/demo/project/web/admin/node_modules/chokidar/lib/nodefs-handler.js:229:14)
at FSWatcher.NodeFsHandler._handleDir 
(/home/demo/project/web/admin/node_modules/chokidar/lib/nodefs-handler.js:408:19)
at FSWatcher.<anonymous> 
(/home/demo/project/web/admin/node_modules/chokidar/lib/nodefs-handler.js:456:19)
at FSWatcher.<anonymous> 
(/home/demo/project/web/admin/node_modules/chokidar/lib/nodefs-handler.js:461:16)
at FSReqWrap.oncomplete (fs.js:123:15)

Gulpfile.js

var gulp = require('gulp');
var Gulp = require('gulp');
var Less = require('gulp-less');
var Path = require('path');
var JShint = require('gulp-jshint');
var Browserify = require('browserify');
var Sourcemaps = require('gulp-sourcemaps');
var Source = require('vinyl-source-stream');
var htmlmin = require('gulp-htmlmin');
var RunSequence = require('run-sequence');
var watch = require('gulp-watch');

Gulp.task('css', function () {
     return watch('./src/css/*.css', function () {
       Gulp.src('./src/css/*.css')
          .pipe(Gulp.dest('./public/css'));
    });
});

Gulp.task('default', ['css'], function () {});

的package.json

{
  "name": "project",
  "version": "1.0.0",
  "description": " Administration Tool",
  "main": "index.js",
  "devDependencies": {
    "browserify": "^7.0.1",
    "browserify-ngannotate": "^0.4.0",
    "browserify-shim": "^3.8.1",
    "deamdify": "^0.1.1",
    "gulp": "^3.9.1",
    "gulp-jshint": "^2.1.0",
    "gulp-less": "^3.5.0",
    "gulp-sourcemaps": "^2.6.4",
    "gulp-htmlmin": "^4.0.0",
    "gulp-watch": "^5.0.0",
    "jshint": "^2.9.5",
    "run-sequence": "^1.0.2",
    "vinyl-source-stream": "^1.0.0"
  },
  "browser": {
    "angular": "./src/vendor/angular/angular.js",
    "angular-animate": "./src/vendor/angular-animate/angular-animate.js",
    "angular-bootstrap": "./src/vendor/angular-bootstrap/ui-bootstrap-tpls.js",
    "angular-cookies": "./src/vendor/angular-cookies/angular-cookies.js",
    "angular-resource": "./src/vendor/angular-resource/angular-resource.js",
    "angular-sanitize": "./src/vendor/angular-sanitize/angular-sanitize.js",
    "angular-storage": "./src/vendor/ngstorage/ngStorage.js",
    "angular-touch": "./src/vendor/angular-touch/angular-touch.js",
    "angular-translate": "./src/vendor/angular-translate/angular-translate.js",
    "angular-ui-router": "./src/vendor/angular-ui-router/release/angular-ui-router.js",
    "angular-ui-utils": "./src/vendor/angular-ui-utils/ui-utils.js",
    "angular-ui-select": "./src/vendor/angular-ui-select/dist/select.js",
    "angular-gravatar": "./src/vendor/angular-gravatar/build/angular-gravatar.js",
    "angular-toaster": "./src/vendor/angularjs-toaster/toaster.js",
    "angular-breadcrumb": "./src/vendor/angular-breadcrumb/dist/angular-breadcrumb.js",
    "md5": "./src/vendor/angular-gravatar/build/md5.js",
    "ocLazyLoad": "./src/vendor/oclazyload/dist/ocLazyLoad.js",
    "jquery": "./src/vendor/jquery/dist/jquery.js",
    "http-auth-interceptor": "./src/vendor/angular-http-auth/src/http-auth-interceptor.js",
    "moment": "./src/vendor/moment/moment.js",
    "lunr": "./src/vendor/lunr.js/lunr.js",
    "linq": "./src/vendor/linqjs-amd/linq.js"
  },
  "browserify-shim": {
    "jquery": "$",
    "angular": {
      "depends": "jquery:jQuery",
      "exports": "angular"
    },
    "angular-animate": {
      "depends": "angular",
      "exports": "angular.module('ngAnimate').name"
    },
    "angular-bootstrap": {
      "depends": "angular",
      "exports": "angular.module('ui.bootstrap').name"
    },
    "angular-cookies": {
      "depends": "angular",
      "exports": "angular.module('ngCookies').name"
    },
    "angular-resource": {
      "depends": "angular",
      "exports": "angular.module('ngResource').name"
    },
    "angular-sanitize": {
      "depends": "angular",
      "exports": "angular.module('ngSanitize').name"
    },
    "angular-storage": {
      "depends": "angular",
      "exports": "angular.module('ngStorage').name"
    },
    "angular-touch": {
      "depends": "angular",
      "exports": "angular.module('ngTouch').name"
    },
    "angular-translate": {
      "depends": "angular",
      "exports": "angular.module('pascalprecht.translate').name"
    },
    "angular-ui-router": {
      "depends": "angular",
      "exports": "angular.module('ui.router').name"
    },
    "angular-ui-utils": {
      "depends": "angular",
      "exports": "angular.module('ui.utils').name"
    },
    "angular-ui-select": {
      "depends": "angular",
      "exports": "angular.module('ui.select').name"
    },
    "md5": {
      "depends": "angular",
      "exports": "angular.module('md5').name"
    },
    "angular-gravatar": {
      "depends": [
        "angular"
      ],
      "exports": "angular.module('ui.gravatar').name"
    },
    "angular-toaster": {
      "depends": [
        "angular",
        "angular-animate"
      ],
      "exports": "angular.module('toaster').name"
    },
    "angular-breadcrumb": {
      "depends": [
        "angular"
      ],
      "exports": "angular.module('ncy-angular-breadcrumb').name"
    },
    "http-auth-interceptor": {
      "depends": "angular",
      "exports": "angular.module('http-auth-interceptor').name"
    },
    "ocLazyLoad": {
      "depends": "jquery:jQuery"
    },
    "moment": {
      "exports": "moment"
    },
    "lunr": {
      "exports": "lunr"
    }
  },
  "browserify": {
    "transform": [
      "browserify-shim"
    ]
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "dependencies": {}
}

1 个答案:

答案 0 :(得分:0)

系统中可以观看的文件数量有限制。我们必须增加这个数字。以下命令可用于增加此数字。

这个解决方案对我有用。

echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

来源:Gulp Error: watch ENOSPC