Gruntjs grunt contrib监视未绑定递归错误

Gruntjs grunt contrib监视未绑定递归错误,gruntjs,grunt-contrib-watch,Gruntjs,Grunt Contrib Watch,我收到了和这家伙一样的错误信息: 在此grunt文件上运行“grunt watch”时: module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), uglify: { options: { banner: '//Copyright (c) 2014 <%= p

我收到了和这家伙一样的错误信息:

在此grunt文件上运行“grunt watch”时:

module.exports = function(grunt) {

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        uglify: {
            options: {
                banner: '//Copyright (c) 2014 <%= pkg.author %>. All Rights Reserved.\n'
                },
            build: {
                files: {
                    "Static/JavaScript/<%= pkg.name %>/AppLogic.Min.js": ["Static/JavaScript/<%= pkg.name %>/AppLogic.js"]
                }
            }
        },
        less: {
            production: {
                options: {
                    cleancss: true
                },
                files: {
                    "Static/Css/<%= pkg.name %>/Style.Min.css": ["Static/Css/<%= pkg.name %>/Style.css"]
                }
            }
        },
        watch: {
            scripts: {
                files: ["Static/JavaScript/<%= pkg.name %>/AppLogic.js"],
                tasks: ["uglify"]
            },
            styles: {
                files: ["Static/Css/<%= pkg.name %>/Style.css"],
                tasks: ["less"]
            }
        }
    });

    grunt.loadNpmTasks("grunt-contrib-less");
    grunt.loadNpmTasks("grunt-contrib-uglify");
    grunt.loadNpmTasks("grunt-contrib-watch")

    grunt.registerTask("default", ["uglify", "less"]);
    grunt.registerTask("watch", ["watch"]);
};
module.exports=函数(grunt){
grunt.initConfig({
pkg:grunt.file.readJSON('package.json'),
丑陋的:{
选项:{
横幅:“//版权所有(c)2014。保留所有权利。\n”
},
建造:{
档案:{
“Static/JavaScript//AppLogic.Min.js”:[“Static/JavaScript//AppLogic.js”]
}
}
},
减:{
制作:{
选项:{
cleancss:对
},
档案:{
“Static/Css//Style.Min.Css”:[“Static/Css//Style.Css”]
}
}
},
观察:{
脚本:{
文件:[“Static/JavaScript//AppLogic.js”],
任务:[“丑陋”]
},
风格:{
文件:[“Static/Css//Style.Css”],
任务:[“更少”]
}
}
});
grunt.loadNpmTasks(“grunt contrib less”);
grunt.loadNpmTasks(“grunt contrib uglify”);
grunt.loadNpmTasks(“grunt contrib watch”)
registerTask(“default”,“uglify”,“less”);
grunt.registerTask(“watch”、[“watch”]);
};
从答案来看,我的问题似乎与另一个问题有不同的原因,但肯定有问题

在没有参数的情况下运行grunt运行得很好,因此“丑陋”和“更少”似乎是正确构造的

运行“grunt watch:scripts”或“grunt watch:styles”也会导致错误

有什么想法吗

备注:grunt/grunt cli安装在我的应用程序本地,而不是全局安装在我的计算机上。不要认为解决这个问题有什么不同,但为了完整起见

此外,在错误弹出之前,我多次收到以下警告:


(节点)警告:检测到Recursive process.nextTick。这将在节点的下一个版本中中断。请使用setImmediate进行递归延迟。

啊,问题不是我的“监视”任务结构,而是这一行:

grunt.registerTask("watch", ["watch"]);
将任务命名为与其参数不同的名称修复了问题,如下所示:

grunt.registerTask("watch_", ["watch"]);
以下答案的功劳,很抱歉重复:

可能存在的副本