Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
402 views
in Technique[技术] by (71.8m points)

node.js - grunt throw "Recursive process.nextTick detected"

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"
  }
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...