【问题标题】:Running "watch" task Waiting... Warning: EMFILE, too many open files '../..'正在运行“监视”任务等待...警告:EMFILE,打开的文件太多“../..”
【发布时间】:2016-03-19 13:09:17
【问题描述】:

所以我的 grunt watch 出现问题,每当我进行更改时,它似乎都没有接收到更改,但一分钟后,我的控制台似乎收到了以下错误的垃圾邮件

Running "watch" task
Waiting...
Warning: EMFILE, too many open files '../..'

是他们用以下几行垃圾邮件。

(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.

紧随其后

util.js:35
  var str = String(f).replace(formatRegExp, function(x) {
                      ^
RangeError: Maximum call stack size exceeded

我已经更改了 ulimit,但这没有任何效果,并且仍然产生相同的错误...这是我的 grunt 文件的配置。

module.exports = function (grunt) {

    require('load-grunt-tasks')(grunt);

    var compass = require('compass-importer');

    grunt.initConfig({

        pkg: grunt.file.readJSON('package.json'),

        /**
         *
         * Project Settings
         *
         */
        project: {
            name: 'corral',
            url: 'http://localhost:8888/Corral-Site/',
            sass: ['../lib/scss'],
            css: ['../lib/css'],
            images: ['../lib/images'],
            js: ['../lib/js'],
            fonts: ['../lib/fonts'],
            tmp: ['.tmp']
        },

        // Look for CSS files, and JS files and concatenate into single files
        bower_concat: {
            all: {
                dest: {
                  js: '.tmp/js/bower.js',
                  css: '.tmp/css/bower.css'
                },
                bowerOptions: {
                    relative: false
                },
                mainFiles: {
                    'jquery' : ['dist/jquery.min.js']
                }
            }
        },

        // Look for all SCSS files and compile into import maps
        sass_globbing: {
            project: {
                files: {
                    '<%= project.sass %>/_bin_importMap.scss': '<%= project.sass %>/bin/**/*.scss',
                    '<%= project.sass %>/_atoms_importMap.scss': '<%= project.sass %>/atoms/**/*.scss',
                    '<%= project.sass %>/_molecules_importMap.scss': '<%= project.sass %>/molecules/**/*.scss',
                    '<%= project.sass %>/_organisms_importMap.scss': '<%= project.sass %>/organisms/**/*.scss'
                },
                options: {
                    useSingleQuotes: false
                }
            }
        },

        // Compass: Compile SCSS files into CSS
        sass: {
            options: {
                includePaths: [
                    '.compass',
                    'bower_components/susy/sass'
                ],
                importer: compass,
                sourceComments: true,
                noCache: 'true'
            },
            dist: {
                files: {
                    '<%= project.css %>/theme.css': '<%= project.sass %>/theme.scss'
                }
            }
        },

        // Concatenate the CSS and JS files
        concat: {
            js: {
                src: [
                    '<%= project.tmp %>/js/bower.js',
                    '<%= project.js %>/active/**/*.js',
                    '!<%= project.js %>/<%= project.name %>.js',
                    '!<%= project.js %>/<%= project.name %>.min.js',
                ],
                dest: '<%= project.js %>/<%= project.name %>.js'
            },
            css: {
                src: [
                    '<%= project.css %>/*.css',
                    '<%= project.tmp %>/css/bower.css',
                    '!<%= project.css %>/editor.css',
                    '!<%= project.css %>/<%= project.name %>.css',
                    '!<%= project.css %>/<%= project.name %>.min.css',
                ],
                dest: '<%= project.css %>/<%= project.name %>.css'
            }
        },

        // Minify CSS files
        cssmin: {
            minify: {
                expand: true,
                cwd: '<%= project.css %>/',
                src: [
                    '<%= project.name %>.css'
                ],
                dest: '<%= project.css %>/',
                ext: '.min.css'
            }
        },

        // Minify JS files
        uglify: {
            js: {
                files: {
                    '<%= project.js %>/<%= project.name %>.min.js': '<%= project.js %>/<%= project.name %>.js'
                }
            }
        },

        // Create spritesheet
        sprite: {
            all: {
                src: [
                    '<%= project.images %>/sprite-src/*.png',
                ],
                retinaSrcFilter: ['<%= project.images %>/sprite-src/*@2x.png'],
                retinaDest: 'spritesheet-2x.png',
                dest: '<%= project.images %>/spritesheet.png',
                destCss: '<%= project.sass %>/bin/_sprites.scss',
                imgPath: '../images/spritesheet.png'
            }
        },

        // Watch for changes
        watch: {
            options: {
                livereload: true,
                nobeep: true,
                interval: 5007
            },
            //dont: {
            //
            //    files: ['**/node_modules/**/*',
            //            '**/bower_components/**/*']
            //
            //},
            config: {
                files: [
                    'Gruntfile.js'
                ]
            },
            js: {
                files: [
                    '<%= project.js %>/**/*.js',
                    '<%= project.tmp %>/js/bower.js',
                    '!<%= project.js %>/bin/inactive/**/*.js',
                    '!<%= project.js %>/<%= project.name %>.js',
                    '!<%= project.js %>/<%= project.name %>.min.js'
                ],
                tasks: [
                    'concat:js',
                    'uglify'
                ]
            },
            php: {
                files: [
                    '../../**/*.php'
                ]
            },
            bower: {
                files: [
                    'bower_components/**/*.css',
                    'bower_components/**/*.js'
                ],
                tasks: [
                    'bower_concat'
                ]
            },
            css: {
                files: [
                    '<%= project.css %>/**/*.css',
                    '!<%= project.css %>/theme.css',
                    '!<%= project.css %>/<%= project.name %>.css',
                    '!<%= project.css %>/<%= project.name %>.min.css'
                ],
                tasks: [
                    'concat:css',
                    'cssmin'
                    //'clean:css'
                ]
            },
            image: {
                files: [
                    '<%= project.images %>/**/*.png',
                    '!<%= project.images %>/spritesheet.png'
                ],
                tasks: [
                    'sprite:all'
                ]
            },
            sass: {
                files: [
                    '<%= project.sass %>/**/*.scss',
                    '../fct/scss/*.scss',
                    '!<%= project.sass %>/*importMap.scss'
                ],
                tasks: [
                    //'sass_globbing',
                    'sass',
                    'concat:css',
                    'cssmin'
                ]
            }
        }
    });

    // Grunt Launch task
    grunt.registerTask('launch', [
        'bower_concat',
        'sass_globbing',
        'sass',
        'concat:css',
        'cssmin',
        'concat:js',
        'uglify',
        'sprite:all',
        'watch'
    ]);

    grunt.registerTask('compile', [
        'bower_concat',
        'sass_globbing',
        'sass',
        'concat:css',
        'cssmin',
        'concat:js',
        'uglify',
        'sprite:all'
    ]);

};

【问题讨论】:

    标签: javascript gruntjs grunt-contrib-watch


    【解决方案1】:

    试试下面并增加临时空间 ulimit -n 10480

    如果上述方法不起作用,请尝试重新启动系统。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-14
      • 2019-08-11
      • 2018-04-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多