区域:<root>;任务:Promise.then;值:RangeError:超出最大调用堆栈大小

时间:2019-06-07 11:43:42

标签: angular

我开发了一个使用angular2版本2.0.0-beta.11的项目(移动应用程序),并且我已经在这个项目上工作了大约2年,应用程序可以编译并且可以很好地加载,但是当我登录到我的应用程序并路由到仪表板屏幕,则在iOS 12.2及更高版本中会引发“超出最大呼叫堆栈大小...”。以下版本均未出现问题。如果我从html模板中删除了一些行,则它的工作方式类似于70kb文件大小,但是如果我在该文件中添加了一些html行,并且文件大小变为90kb,则行不通,并抛出以下错误:

Unhandled Promise rejection: Maximum call stack size exceeded. ; Zone: <root> ; Task: Promise.then ; Value: RangeError: Maximum call stack size exceeded. ChangeDetector_DashboardComponent_0

viewFactory_DashboardComponent0
viewFactory_HostDashboardComponent0
createHostViewInContainer@file:///var/mobile/Containers/Data/Application/956DEEEF-17A4-43CF-B2C5-1ACB29B8EA76/Library/Application%20Support/Forge/assets-216AAE18-7A5E-40F0-BEB9-994B69237FD5/src/scripts/angular2.dev.js:6723:45
createHostView@file:///var/mobile/Containers/Data/Application/956DEEEF-17A4-43CF-B2C5-1ACB29B8EA76/Library/Application%20Support/Forge/assets-216AAE18-7A5E-40F0-BEB9-994B69237FD5/src/scripts/angular2.dev.js:6205:42
file:///var/mobile/Containers/Data/Application/956DEEEF-17A4-43CF-B2C5-1ACB29B8EA76/Library/Application%20Support/Forge/assets-216AAE18-7A5E-40F0-BEB9-994B69237FD5/src/scripts/angular2.dev.js:12419:55
run@file:///var/mobile/Containers/Data/Application/956DEEEF-17A4-43CF-B2C5-1ACB29B8EA76/Library/Application%20Support/Forge/assets-216AAE18-7A5E-40F0-BEB9-994B69237FD5/src/scripts/zone.min.js:1:18045
file:///var/mobile/Containers/Data/Application/956DEEEF-17A4-43CF-B2C5-1ACB29B8EA76/Library/Application%20Support/Forge/assets-216AAE18-7A5E-40F0-BEB9-994B69237FD5/src/scripts/zone.min.js:1:28176
runTask@file:///var/mobile/Containers/Data/Application/956DEEEF-17A4-43CF-B2C5-1ACB29B8EA76/Library/Application%20Support/Forge/assets-216AAE18-7A5E-40F0-BEB9-994B69237FD5/src/scripts/zone.min.js:1:18749
o@file:///var/mobile/Containers/Data/Application/956DEEEF-17A4-43CF-B2C5-1ACB29B8EA76/Library/Application%20Support/Forge/assets-216AAE18-7A5E-40F0-BEB9-994B69237FD5/src/scripts/zone.min.js:1:15791
invokeTask@file:///var/mobile/Containers/Data/Application/956DEEEF-17A4-43CF-B2C5-1ACB29B8EA76/Library/Application%20Support/Forge/assets-216AAE18-7A5E-40F0-BEB9-994B69237FD5/src/scripts/zone.min.js:1:24729
d@file:///var/mobile/Containers/Data/Application/956DEEEF-17A4-43CF-B2C5-1ACB29B8EA76/Library/Application%20Support/Forge/assets-216AAE18-7A5E-40F0-BEB9-994B69237FD5/src/scripts/zone.min.js:1:7037
v@file:///var/mobile/Containers/Data/Application/956DEEEF-17A4-43CF-B2C5-1ACB29B8EA76/Library/Application%20Support/Forge/assets-216AAE18-7A5E-40F0-BEB9-994B69237FD5/src/scripts/zone.min.js:1:7277

My package.json:
{
  "name": "Daysi",
  "version": "1.0.0",
  "scripts": {
    "start": "concurrently \"npm run tsc:w\" \"npm run lite\" ",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "lite": "lite-server",
    "typings": "typings",
    "postinstall": "typings install"
  },
  "license": "ISC",
  "dependencies": {
    "angular2": "2.0.0-beta.11",
    "crypto-js": "^3.1.6",
    "es6-promise": "^3.0.2",
    "es6-shim": "^0.35.0",
    "jquery": "^3.4.1",
    "ng2-translate": "^1.11.0",
    "reflect-metadata": "0.1.2",
    "rxjs": "5.0.0-beta.2",
    "systemjs": "0.19.24",
    "zone.js": "^0.9.1"
  },
  "devDependencies": {
    "concurrently": "^2.0.0",
    "gulp": "^4.0.0",
    "lite-server": "^2.5.3",
    "typescript": "^1.8.9",
    "typings": "^0.7.9"
  }
}

2 个答案:

答案 0 :(得分:0)

这是无限调用发生,当两个组件试图互相渲染时会发生这种情况,假设您已经在组件B的html文件中指定了组件A的选择器,而此时您又在组件A的html文件中指定了B的选择器,两个组件都在相互调用发生循环中和内存堆栈错误,可以共享html代码吗?

答案 1 :(得分:0)

在我的一个项目中使用量角器,打字稿时,我遇到了类似的问题。 这就是我遇到的问题:-

Unhandled rejection RangeError: Maximum call stack size exceeded
at new Wait (D:\workspace\DemoProject\latest-code\protractor-cucumber\e2e\utilities\Wait.ts:5:1)
at new SelectDropDown (D:\workspace\DemoProject\latest-code\protractor-cucumber\e2e\utilities\SelectDropDown.ts:5:1)
at new CLASS1 (D:\workspace\DemoProject\latest-code\protractor-cucumber\e2e\com.blog.page\CLASS1.ts:29:23)
at new CLASS2 (D:\workspace\DemoProject\latest-code\protractor-cucumber\e2e\com.blog.page\CLASS2.ts:25:32)
at new CLASS3 (D:\workspace\DemoProject\latest-code\protractor-cucumber\e2e\com.blog.page\CLASS3.ts:26:25)
at new CLASS1 (D:\workspace\DemoProject\latest-code\protractor-cucumber\e2e\com.blog.page\CLASS1.ts:30:41)
at new CLASS2 (D:\workspace\DemoProject\latest-code\protractor-cucumber\e2e\com.blog.page\CLASS2.ts:25:32)
at new CLASS3 (D:\workspace\DemoProject\latest-code\protractor-cucumber\e2e\com.blog.page\CLASS3.ts:26:25)
at new CLASS1 (D:\workspace\DemoProject\latest-code\protractor-cucumber\e2e\com.blog.page\CLASS1.ts:30:41)
at new CLASS2 (D:\workspace\DemoProject\latest-code\protractor-cucumber\e2e\com.blog.page\CLASS2.ts:25:32)
at new CLASS3 (D:\workspace\DemoProject\latest-code\protractor-cucumber\e2e\com.blog.page\CLASS3.ts:26:25)
at new CLASS1 (D:\workspace\DemoProject\latest-code\protractor-cucumber\e2e\com.blog.page\CLASS1.ts:30:41)
at new CLASS2 (D:\workspace\DemoProject\latest-code\protractor-cucumber\e2e\com.blog.page\CLASS2.ts:25:32)
at new CLASS3 (D:\workspace\DemoProject\latest-code\protractor-cucumber\e2e\com.blog.page\CLASS3.ts:26:25)
at new CLASS1 (D:\workspace\DemoProject\latest-code\protractor-cucumber\e2e\com.blog.page\CLASS1.ts:30:41)
at new CLASS2 (D:\workspace\DemoProject\latest-code\protractor-cucumber\e2e\com.blog.page\CLASS2.ts:25:32)

解决方案技术栈我的哪个项目:-

  • 量角器
  • 打字稿
  • 页面对象模式
  • 黄瓜
  • 节点
  • npm
  • VS代码(IDE)

循环依赖关系和循环对象创建。 这意味着CLASS1具有CLASS2的对象, CLASS2具有CLASS3的对象,并且 CLASS3具有CLASS1的对象。 因此,这会在代码中创建circulaR依赖项。

https://khyatisehgal.wordpress.com/2014/07/22/unhandled-rejection-rangeerror-maximum-call-stack-size-exceeded/