“递归过程. 检测到 nextTick”

我用 nodejs v0.10.26运行 Lion 10.9.2

我想建立一个自动编译的 Sass 文件和一个实时重新加载与咕哝,没有什么复杂的,但..。

当运行 grunt watch时,我得到以下错误

(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

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


};

这是包裹 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"
}
}
27745 次浏览

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

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.

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

The solution? Use sudo grunt serve instead

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

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.

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