grunt throw "Recursive process.nextTick detected"

node.jsGruntjsGrunt Contrib-Watch

node.js Problem Overview


I'm running Lion 10.9.2 with nodejs v0.10.26

I want to setup an automated compilation on sass files and a live reload with grunt, nothing complicated but...

When running grunt watch I get the following error

(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

here is the Gruntfile.js

module.exports = function(grunt) {

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        sass: {
            dist: {
                files: {
                    'assets/css/styles.css': 'assets/sass/styles.scss'
                }
            }
        },
        watch: {
            all: {
                files: 'index.html', // Change this if you are not watching index.html
                options: {
                    livereload: true  // Set livereload to trigger a reload upon change
                }
            },
            css: {
                files:  [ 'assets/sass/**/*.scss' ],
                tasks:  [ 'sass' ],
                options: {
                    spawn: false
                }
            },
            options: {
                livereload: true // Set livereload to trigger a reload upon change
            }
        }

    });

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-sass');

    grunt.registerTask('watch', [ 'watch']);

    grunt.registerTask('default', [ 'sass', 'watch' ]);

};

and here is the package.json

{
  "name": "application",
  "version": "0.0.1",
  "private": true,
  "devDependencies": {
    "grunt": "~0.4.2",
    "grunt-contrib-watch": "~0.5.3",
    "grunt-contrib-sass": "~0.7.3"
  }
}

node.js Solutions


Solution 1 - node.js

I finally figured out a similar problem I was having with SASS. I was using

grunt.registerTask('sass', [ 'sass']);

The trick was that Grunt doesn't seem to like the repetition in names. When I switch to

grunt.registerTask('styles', [ 'sass']);

Everything worked as it should.

Solution 2 - node.js

Just had this problem. Resolved it by removing grunt.registerTask('watch', [ 'watch']);

Solution 3 - node.js

I just fixed a similar error "Recursive process.nextTick detected" causing by command: grunt server

The solution? Use sudo grunt serve instead

Solution 4 - node.js

you could try this one, it fixed the issue for me, working with Yeoman 1.3.3 and Ubuntu 14.04 https://stackoverflow.com/questions/16748737/grunt-watch-error-waiting-fatal-error-watch-enospc

Solution 5 - node.js

I was getting error in even trying to install grunt. Running npm dedupe solved my problem as answered here: https://stackoverflow.com/questions/16748737/grunt-watch-error-waiting-fatal-error-watch-enospc/17437601#17437601

Solution 6 - node.js

Alternative solution: check your watch for an empty file argument.

Here's an excerpt of my gruntfile

watch: {
  all: {
    options:{
      livereload: true
    },
    files: ['src/scss/*.scss', 'src/foo.html',, 'src/bar.html'],
    tasks: ['default']
  }
}

In my case, I could recreate the original poster's error on demand with the empty argument above.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiondenisjacqueminView Question on Stackoverflow
Solution 1 - node.jsBob RockefellerView Answer on Stackoverflow
Solution 2 - node.jsAbraham ParangiView Answer on Stackoverflow
Solution 3 - node.jskrazywebView Answer on Stackoverflow
Solution 4 - node.jshybrisColeView Answer on Stackoverflow
Solution 5 - node.jsdreamerkumarView Answer on Stackoverflow
Solution 6 - node.jsBrian MuenzenmeyerView Answer on Stackoverflow