【发布时间】:2014-11-23 19:29:20
【问题描述】:
我得到了和这个人一样的错误信息:
grunt-contrib-watch causing Maximum call stack size exceeded
在这个 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"]);
};
看答案,我的问题似乎与其他问题的原因不同,但肯定有问题。
运行不带参数的 grunt 运行良好,因此“uglify”和“less”似乎构造正确。
运行“grunt watch:scripts”或“grunt watch:styles”也会导致错误。
有什么想法吗?
PS:grunt/grunt-cli 安装在我的应用程序本地,而不是全局安装在我的机器上。不要认为解决这个问题有什么不同,但为了完整起见......
此外,在弹出错误之前,我多次收到以下警告:
(节点)警告:检测到递归 process.nextTick。这将在下一个版本的节点中中断。请使用 setImmediate 进行递归延迟。
【问题讨论】:
标签: gruntjs grunt-contrib-watch