Gruntjs grunt contrib监视导致超过最大调用堆栈大小
当我执行clean任务(grunt clean)时,一切正常,但当我运行watch任务(grunt test)时,我得到以下错误:Gruntjs grunt contrib监视导致超过最大调用堆栈大小,gruntjs,grunt-contrib-watch,Gruntjs,Grunt Contrib Watch,当我执行clean任务(grunt clean)时,一切正常,但当我运行watch任务(grunt test)时,我得到以下错误: util.js:35 var str = String(f).replace(formatRegExp, function(x) { ^ RangeError: Maximum call stack size exceeded 这是我的文件 module.exports = (grunt) -> grunt.in
util.js:35
var str = String(f).replace(formatRegExp, function(x) {
^
RangeError: Maximum call stack size exceeded
这是我的文件
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
clean: ['tmpDir/']
watch:
options:
spawn: false
src:
tasks: ['clean']
files: [
src: 'client/assets/strings/en/str.coffee'
]
# plugins
grunt.loadNpmTasks('grunt-contrib-clean')
grunt.loadNpmTasks('grunt-contrib-watch')
# tasks
grunt.registerTask('test', ['watch'])
这是我的package.json文件:
{
"author": "Your Name <Your Email>",
"name": "app-name",
"description": "Application description",
"version": "0.0.1",
"homepage": "",
"repository": {
"type": "git",
"url": ""
},
"engines": {
"node": "~0.10.28"
},
"scripts": {
"start": "muffin server"
},
"dependencies": {
"coffee-script": "~1.1.2",
"express": "~3.0.6",
"chai": "~1.4.2",
"underscore": "~1.4.3",
"wd": "0.0.27"
},
"devDependencies": {
"express": "~3.0.6",
"grunt": "^0.4.5",
"grunt-contrib-coffee": "^0.11.1",
"grunt-contrib-copy": "^0.6.0",
"grunt-contrib-less": "^0.11.4",
"grunt-contrib-watch": "^0.6.1",
"requirejs": "~2.0.1"
}
}
files
属性接受一个文件模式字符串数组。您提供了一个它不知道如何解释的对象
更改此项:
files: [
src: 'client/assets/strings/en/str.coffee'
]
为此:
files: [
'client/assets/strings/en/str.coffee'
]
我最终发现了一个与拼写相似的问题。我在用 grunt.registerTask('spell',['spell']); 诀窍在于,格伦特似乎不喜欢名字的重复。当我切换到 grunt.registerTask('spellCheck',['spell']); 一切正常
这可能会帮助您您的监视任务不偶然监视node_modules目录吗?@DeadCalimero-不,不是。我甚至尝试过指定一个输出没有变化的特定文件。不幸的是,这并没有为我解决它。最终,这确实解决了它。重试时出现用户错误。非常感谢@kyleThis帮我修好了。谢谢您可能创建了一个别名任务,其名称与您的一个常规任务相同。见:
files: [
'client/assets/strings/en/str.coffee'
]