grunt throw "Recursive process.nextTick detected"
Asked Answered
A

6

90

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"
  }
}
Auston answered 9/3, 2014 at 18:5 Comment(0)
S
299

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.

Scallop answered 14/3, 2014 at 15:31 Comment(3)
awesome, thanks for spotting this. I realised we don't need to register a single task anyway, because grunt will run 'grunt sass' when you type that into the command line.Befoul
Thank you for answering this... I've been bashing my head on the desk for the last hour and a half figuring out why the grunt-bower-concat plugin was giving me that output.Mestas
Oddly worked for me fine with sass, but broke on watch, thanksLounging
P
17

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

Phare answered 10/3, 2014 at 22:45 Comment(0)
F
11

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

The solution? Use sudo grunt serve instead

Footpoundsecond answered 20/4, 2014 at 14:54 Comment(1)
this should never be the solution. sudo shouldn't be used unless its something that is actually changing your system. It sounds like you did sudo npm install which is often badCassiodorus
J
1

you could try this one, it fixed the issue for me, working with Yeoman 1.3.3 and Ubuntu 14.04 Grunt watch error - Waiting...Fatal error: watch ENOSPC

Jellied answered 14/11, 2014 at 20:13 Comment(0)
M
1

I was getting error in even trying to install grunt. Running npm dedupe solved my problem as answered here: Grunt watch error - Waiting...Fatal error: watch ENOSPC

Morie answered 18/6, 2016 at 21:17 Comment(0)
D
0

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.

Danit answered 10/12, 2014 at 21:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.