Tunds
Tunds

Reputation: 1817

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

So i'm having issues with my grunt watch it doesn't seem to be picking up the changes whenever i make a change but a minute later my console seems to be spammed with the following error

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

It's them spammed with the following lines.

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

Followed by

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

I've changed the ulimit but this has had no effect and is still producing the same errors... This is the configuration of my grunt file.

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'
    ]);

};

Upvotes: 1

Views: 518

Answers (2)

karthik baalaji M
karthik baalaji M

Reputation: 1

Check whether the folder you have grunt stuffs is in symlinked with other ,it may cause this ,Remove the link and try once Try grunt watch --verbose as well. Make sure it's matching all the files you're intending (maybe a file pattern running wild?)

Upvotes: 0

Thamizhselvan
Thamizhselvan

Reputation: 144

Try below and increase the temp space ulimit -n 10480

If above is not working try hard restarting the system.

Upvotes: 0

Related Questions