node.js 咕噜声抛出“检测到递归 process.nextTick”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22285942/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 16:59:07  来源:igfitidea点击:

grunt throw "Recursive process.nextTick detected"

node.jsgruntjsgrunt-contrib-watch

提问by denisjacquemin

I'm running Lion 10.9.2 with nodejs v0.10.26

我正在使用 nodejs v0.10.26 运行 Lion 10.9.2

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

我想在 sass 文件上设置自动编译并使用 grunt 实时重新加载,没什么复杂的但是......

When running grunt watchI get the following error

运行时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

here is the Gruntfile.js

这是 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

这是 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"
  }
}

回答by Bob Rockefeller

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

我终于发现了我在使用 SASS 时遇到的类似问题。我正在使用

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

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

诀窍是 Grunt 似乎不喜欢名称中的重复。当我切换到

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

Everything worked as it should.

一切正常。

回答by Abraham Parangi

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

刚遇到这个问题。通过删除解决它grunt.registerTask('watch', [ 'watch']);

回答by krazyweb

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

我刚刚修复了由命令引起的类似错误“检测到递归 process.nextTick”:grunt server

The solution? Use sudo grunt serve instead

解决方案?改用 sudo grunt serve

回答by hybrisCole

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

你可以试试这个,它为我解决了这个问题,使用 Yeoman 1.3.3 和 Ubuntu 14.04 Grunt watch error - Waiting... Fatal error: watch ENOSPC

回答by Brian Muenzenmeyer

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

替代解决方案:检查您的手表是否有空文件参数

Here's an excerpt of my gruntfile

这是我的摘录 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.

就我而言,我可以使用上面的空参数按需重新创建原始海报的错误。

回答by dreamerkumar

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

我什至在尝试安装 grunt 时都会出错。运行 npm dedupe 解决了我的问题,答案如下:Grunt watch error - Waiting... Fatal error: watch ENOSPC