我收到了这个错误:
angular.js:4767 Uncaught RangeError: Maximum call stack size exceeded
at Object.invoke (angular.js:4767)
at angular.js:4574
at forEach (angular.js:325)
at createInjector (angular.js:4574)
at doBootstrap (angular.js:1805)
at bootstrap (angular.js:1826)
at angularInit (angular.js:1711)
at HTMLDocument.<anonymous> (angular.js:32539)
at fire (jquery.js:3187)
at Object.fireWith [as resolveWith] (jquery.js:3317)
我知道它不是我的代码中的循环,因为同一项目在其他环境中有效,所以我怀疑问题出在我的node
或grunt
。
node v5.3.0
grunt v0.4.5
grunt-cli v1.2.0
以下是开发人员的grunt命令:
grunt.registerTask('dev', ['ngconstant:dev', 'dom_munger:read', 'jshint', 'ngtemplates', 'less', 'connect', 'watch']);
和packages.json
:
{
"name": "myapp.maso.app",
"version": "1.0.0-beta.172",
"repository": {
"type": "git",
"url": ""
},
"devDependencies": {
"chai": "^3.5.0",
"chromedriver": "~2.21.2",
"grunt": "~0.4.5",
"grunt-angular-templates": "~1.0.3",
"grunt-browser-output": "1.0.3",
"grunt-connect-proxy": "^0.2.0",
"grunt-contrib-clean": "~1.0.0",
"grunt-contrib-concat": "~1.0.0",
"grunt-contrib-connect": "~1.0.0",
"grunt-contrib-copy": "~1.0.0",
"grunt-contrib-cssmin": "~1.0.1",
"grunt-contrib-htmlmin": "~1.1.0",
"grunt-contrib-imagemin": "~1.0.0",
"grunt-contrib-jshint": "~1.0.0",
"grunt-contrib-less": "^1.2.0",
"grunt-contrib-uglify": "~1.0.1",
"grunt-contrib-watch": "~1.0.0",
"grunt-dom-munger": "~3.4",
"grunt-karma": "~0.12.2",
"grunt-manifest": "^0.4.4",
"grunt-ng-annotate": "^2.0.1",
"grunt-ng-constant": "^2.0.1",
"grunt-npm-install": "^0.3.1",
"grunt-protractor-runner": "~3.0.0",
"grunt-serve": "^0.1.6",
"grunt-version": "^1.0.0",
"jshint-stylish": "^2.1.0",
"karma": "^0.13.22",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "~0.2.2",
"karma-firefox-launcher": "~0.1.7",
"karma-jasmine": "~0.3.8",
"karma-mocha": "^0.2.2",
"karma-mocha-reporter": "~2.0.0",
"karma-ng-html2js-preprocessor": "^0.2.1",
"karma-ng-json2js-preprocessor": "^1.1.2",
"karma-phantomjs-launcher": "^1.0.0",
"less": "^2.6.1",
"load-grunt-tasks": "~3.4.1",
"mocha": "^2.4.5",
"protractor": "~3.2.1",
"webdriver-manager": "~8.0.0"
}
}
如果有人可以帮助我调试这个,我已经尝试了许多其他问题和GitHub问题,但我仍然无法解决这个问题。
如果需要更多信息,请在下面发表评论。
编辑 - 我所有的笨拙任务:
grunt.registerTask('dev', ['ngconstant:dev', 'dom_munger:read', 'jshint', 'ngtemplates', 'less', 'connect', 'watch']);
grunt.registerTask('live', ['ngconstant:live', 'dom_munger:read', 'jshint', 'ngtemplates', 'less', 'connect', 'watch']);
// isracard development environment
grunt.registerTask('devi', ['ngconstant:devi', 'dom_munger:read', 'jshint', 'less', 'connect', 'watch']);
grunt.registerTask('livei', ['ngconstant:livei', 'dom_munger:read', 'jshint', 'less', 'connect', 'watch']);
grunt.registerTask('forms', ['ngconstant:forms', 'dom_munger:read', 'jshint', 'less', 'connect', 'watch']);
// build
grunt.registerTask('build', ['ngconstant:live', 'version:project:prerelease', 'jshint', 'clean:before', 'less', 'dom_munger', 'ngtemplates', 'cssmin', 'concat', 'ngAnnotate', 'copy', 'htmlmin', 'manifest', 'clean:after']);
grunt.registerTask('test', ['ngconstant:mock', 'dom_munger:read', 'karma:all_tests']);
grunt.registerTask('e2e', ['dom_munger:read', 'protractor']);
非常感谢。
答案 0 :(得分:0)
好吧,GruntJS
FAQ说明了,
您可能创建了一个与常规任务同名的别名任务
示例: grunt.registerTask('uglify', ['uglify:my_target']);
应为grunt.registerTask('myUglify', ['uglify:my_target']);.
请检查您是否犯过任何错误。
希望这有帮助!
答案 1 :(得分:0)
因此,这意味着您已超过JS引擎允许的最大调用次数。这可能意味着两件事之一:
+
运算符的绝对数量导致堆栈大小溢出。当我试图将模拟数据注入Karma测试时,我自己也遇到过这种情况 - 显然11,000行太多而不能加在一起。不幸的是,除了尝试逐位隔离代码并查看是否可以追踪问题之外,没有其他方法可以对此进行测试。有一点可以帮助我使用node-inspector工具并在抛出错误之前将其设置为中断 - 然后您可以调查调用堆栈,看看是否可以通过追溯来学习任何内容。祝你好运!
(请注意,这不是独占列表 - 可能还有其他原因 - 这些只是我经常遇到的两个原因。)