angular-cli: Maximum call stack size exceeded

I’m submitting a…


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x ] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request 

Current behavior

Hi I created a project with cli version 1.6.6 and i’ve work on this project about a month, always ng serve testing and today I’ve want to deploy on server and when I run ‘ng build --prod’ it throws ‘Maximum call stack size exceeded…’ I look this post with likely behaviour and doesn’t seem to be fixed 😦

Expected behavior

It should complile without problems.

Minimal reproduction of the problem with instructions

`C:\Users\Diego Mendez\Desktop\innovacion-notaria-digital>ng build --pr od 10% building modules 0/1 modules 1 active …nnovacion-notaria-digita 10% building modules 1/2 modules 1 active …cion-notaria-digital\src 10% building modules 2/3 modules 1 active …acion-notaria-digital\sr 10% building modules 3/4 modules 1 active …acion-notaria-digital\sr 10% building modules 3/5 modules 2 active …nnovacion-notaria-digita 10% building modules 3/6 modules 3 active …cion-notaria-digital\src 10% building modules 4/6 modules 2 active …cion-notaria-digital\src 10% building modules 5/6 modules 1 active …acion-notaria-digital\sr c\styles.scssNode#moveTo was deprecated. Use Container#append. 10% building modules 6/7 modules 1 active …de_modules\css-loader\li 10% building modules 7/8 modules 1 active …acion-notaria-digital\sr Date: 2018-02-15T15:01:56.479Z Hash: 2fc5ae5cead61d445921 Time: 17544ms chunk {scripts} scripts.abd2bc1a81803e88ec1c.bundle.js (scripts) 160 k B [initial] [rendered] chunk {0} styles.b71bf03706da12181fe1.bundle.css (styles) 198 kB [init ial] [rendered] chunk {1} polyfills.3bc34265385d52184eab.bundle.js (polyfills) 86 byte s [initial] [rendered] chunk {2} main.e402deade8b026b7d50e.bundle.js (main) 84 bytes [initial ] [rendered] chunk {3} inline.9d07561b59257af76b95.bundle.js (inline) 1.45 kB [entr y] [rendered]

ERROR in RangeError: Maximum call stack size exceeded at AotSummaryResolver.resolveSummary (C:\Users\Diego Mendez\Deskto p\innovacion-notaria-digital\node_modules@angular\compiler\bundles\co mpiler.umd.js:32815:14) at StaticSymbolResolver._resolveSymbolFromSummary (C:\Users\Diego Mendez\Desktop\innovacion-notaria-digital\node_modules@angular\compil er\bundles\compiler.umd.js:29372:61) at StaticSymbolResolver.resolveSymbol (C:\Users\Diego Mendez\Deskt op\innovacion-notaria-digital\node_modules@angular\compiler\bundles\c ompiler.umd.js:29119:74) at resolveReferenceValue (C:\Users\Diego Mendez\Desktop\innovacion -notaria-digital\node_modules@angular\compiler\bundles\compiler.umd.j s:32059:75) at simplify (C:\Users\Diego Mendez\Desktop\innovacion-notaria-digi tal\node_modules@angular\compiler\bundles\compiler.umd.js:32222:65) at simplifyInContext (C:\Users\Diego Mendez\Desktop\innovacion-not aria-digital\node_modules@angular\compiler\bundles\compiler.umd.js:32 427:20) at simplifyNested (C:\Users\Diego Mendez\Desktop\innovacion-notari a-digital\node_modules@angular\compiler\bundles\compiler.umd.js:32084 :28) at simplify (C:\Users\Diego Mendez\Desktop\innovacion-notaria-digi tal\node_modules@angular\compiler\bundles\compiler.umd.js:32224:36) at simplifyInContext (C:\Users\Diego Mendez\Desktop\innovacion-not aria-digital\node_modules@angular\compiler\bundles\compiler.umd.js:32 427:20) at simplifyNested (C:\Users\Diego Mendez\Desktop\innovacion-notari a-digital\node_modules@angular\compiler\bundles\compiler.umd.js:32084 :28) at simplify (C:\Users\Diego Mendez\Desktop\innovacion-notaria-digi tal\node_modules@angular\compiler\bundles\compiler.umd.js:32224:36) at simplifyInContext (C:\Users\Diego Mendez\Desktop\innovacion-not aria-digital\node_modules@angular\compiler\bundles\compiler.umd.js:32 427:20) at simplifyNested (C:\Users\Diego Mendez\Desktop\innovacion-notari a-digital\node_modules@angular\compiler\bundles\compiler.umd.js:32084 :28) at simplify (C:\Users\Diego Mendez\Desktop\innovacion-notaria-digi tal\node_modules@angular\compiler\bundles\compiler.umd.js:32224:36) at simplifyInContext (C:\Users\Diego Mendez\Desktop\innovacion-not aria-digital\node_modules@angular\compiler\bundles\compiler.umd.js:32 427:20) at simplifyNested (C:\Users\Diego Mendez\Desktop\innovacion-notari a-digital\node_modules@angular\compiler\bundles\compiler.umd.js:32084 :28) `

and this is my package.json { "name": "notaria-digital-front", "version": "0.0.0", "license": "MIT", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build --prod", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@agm/core": "^1.0.0-beta.2", "@angular/animations": "^5.2.0", "@angular/cdk": "^5.2.0", "@angular/common": "^5.2.0", "@angular/compiler": "^5.2.0", "@angular/core": "^5.2.0", "@angular/forms": "^5.2.0", "@angular/http": "^5.2.0", "@angular/material": "^5.2.0", "@angular/platform-browser": "^5.2.0", "@angular/platform-browser-dynamic": "^5.2.0", "@angular/router": "^5.2.0", "@types/lodash": "^4.14.98", "angular-google-place": "0.0.3", "bootstrap": "^4.0.0", "core-js": "^2.4.1", "jquery": "^3.3.1", "lodash": "^4.17.4", "ng2-pdf-viewer": "^3.0.8", "ng2-rut": "^0.2.1", "rxjs": "^5.5.6", "tether": "^1.4.3", "zone.js": "^0.8.19" }, "devDependencies": { "@angular/cli": "1.6.6", "@angular/compiler-cli": "^5.2.0", "@angular/language-service": "^5.2.0", "@types/jasmine": "~2.8.3", "@types/jasminewd2": "~2.0.2", "@types/node": "~6.0.60", "codelyzer": "^4.0.1", "jasmine-core": "~2.8.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~2.0.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "^1.2.1", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.1.2", "ts-node": "~4.1.0", "tslint": "~5.9.1", "typescript": "~2.5.3" } }

What is the motivation / use case for changing the behavior?

Environment


Angular version: 5


Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: 8.5.0  
- Platform:  Windows

Others:

Windows 7
12 GB Ram
Sublime text
NPM: 5.6.0

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 3
  • Comments: 19 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@dzonatan looked into this a bit today and I am sorry to report this looks like an existing TypeScript bug: https://github.com/Microsoft/TypeScript/issues/17033

I made another repro for that bug using your file, as it is simpler than the existing repro they have there.

It looks like the newly release TS 2.9.1 does not suffer from that problem. Will see if we can update Build Optimizer to use 2.9.1.

Wooow! That was fast! I want to thank you @filipesilva for fixing this so quickly! 🍻 I wish angular core team would work at such speeds.

I was able to reproduce this bug or something very very similar. I have created a repo here.

Steps to reproduce:

  1. ng new reprobug9636
  2. cd reprobug9636
  3. npm install --save @timkendrick/monaco-editor
  4. Import and use Monaco editor in a component:
import * as monaco from '@timkendrick/monaco-editor';

let editor = monaco.editor.create(new HTMLElement(), {
      theme: "vs-dark",
      language: "csharp"
    });
  1. Run ng build --prod

That gives the following output:

ERROR in ./node_modules/@timkendrick/monaco-editor/dist/standalone/index.js Module build failed: RangeError: Maximum call stack size exceeded at Object.visitEachChild (C:\Users\morga\Downloads\throwaway\reprobug9636\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:51169:28) at visitor (C:\Users\morga\Downloads\throwaway\reprobug9636\node_modules@angular-devkit\build-optimizer\src\transforms\scrub-file.js:84:27) at visitNode (C:\Users\morga\Downloads\throwaway\reprobug9636\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:51053:23) at Object.visitEachChild (C:\Users\morga\Downloads\throwaway\reprobug9636\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:51289:46) at visitor (C:\Users\morga\Downloads\throwaway\reprobug9636\node_modules@angular-devkit\build-optimizer\src\transforms\scrub-file.js:84:27) at visitNode (C:\Users\morga\Downloads\throwaway\reprobug9636\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:51053:23) at Object.visitEachChild (C:\Users\morga\Downloads\throwaway\reprobug9636\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:51289:46) at visitor (C:\Users\morga\Downloads\throwaway\reprobug9636\node_modules@angular-devkit\build-optimizer\src\transforms\scrub-file.js:84:27) at visitNode (C:\Users\morga\Downloads\throwaway\reprobug9636\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:51053:23) at Object.visitEachChild (C:\Users\morga\Downloads\throwaway\reprobug9636\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:51289:46) at visitor (C:\Users\morga\Downloads\throwaway\reprobug9636\node_modules@angular-devkit\build-optimizer\src\transforms\scrub-file.js:84:27) at visitNode (C:\Users\morga\Downloads\throwaway\reprobug9636\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:51053:23) at Object.visitEachChild (C:\Users\morga\Downloads\throwaway\reprobug9636\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:51289:46) at visitor (C:\Users\morga\Downloads\throwaway\reprobug9636\node_modules@angular-devkit\build-optimizer\src\transforms\scrub-file.js:84:27) at visitNode (C:\Users\morga\Downloads\throwaway\reprobug9636\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:51053:23) at Object.visitEachChild (C:\Users\morga\Downloads\throwaway\reprobug9636\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:51289:46)

@filipesilva

Several people who uses ag-grid started getting this error after upgrading angular to v6. https://github.com/ag-grid/ag-grid-angular/issues/184#issuecomment-389157855

Originally, I though it’s ag-grid problem (maybe some circular dependencies) and started looking into it. Deleting line by line I ended up with one file which still causes this “max call stack reached” error. I’ve checked it on several machines with windows 10 - failed on both.

To reproduce add that file in your project or just clone this repo and run ng build --prod.

You should get:

ERROR in ./src/app/my-class.ts
Module build failed: RangeError: Maximum call stack size exceeded
    at getJSDocTags (C:\max-call-stack-repro\node_modules\typescript\lib\typescript.js:11781:26)
    at getFirstJSDocTag (C:\max-call-stack-repro\node_modules\typescript\lib\typescript.js:11792:20)
    at Object.getJSDocTemplateTag (C:\max-call-stack-repro\node_modules\typescript\lib\typescript.js:11734:16)
    at Object.getEffectiveTypeParameterDeclarations (C:\max-call-stack-repro\node_modules\typescript\lib\typescript.js:10393:34)
    at getTypeParametersFromDeclaration (C:\max-call-stack-repro\node_modules\typescript\lib\typescript.js:30240:27)
    at getSignatureFromDeclaration (C:\max-call-stack-repro\node_modules\typescript\lib\typescript.js:30422:82)
    at getSignaturesOfSymbol (C:\max-call-stack-repro\node_modules\typescript\lib\typescript.js:30530:37)
    at resolveAnonymousTypeMembers (C:\max-call-stack-repro\node_modules\typescript\lib\typescript.js:29670:43)
    at resolveStructuredTypeMembers (C:\max-call-stack-repro\node_modules\typescript\lib\typescript.js:29834:25)
    at createTypeNodeFromObjectType (C:\max-call-stack-repro\node_modules\typescript\lib\typescript.js:27149:36)
    at createAnonymousTypeNode (C:\max-call-stack-repro\node_modules\typescript\lib\typescript.js:27120:46)
    at typeToTypeNodeHelper (C:\max-call-stack-repro\node_modules\typescript\lib\typescript.js:27065:28)
    at createTypeNodesFromResolvedType (C:\max-call-stack-repro\node_modules\typescript\lib\typescript.js:27333:67)
    at createTypeNodeFromObjectType (C:\max-call-stack-repro\node_modules\typescript\lib\typescript.js:27167:35)
    at createAnonymousTypeNode (C:\max-call-stack-repro\node_modules\typescript\lib\typescript.js:27120:46)
    at typeToTypeNodeHelper (C:\max-call-stack-repro\node_modules\typescript\lib\typescript.js:27065:28)

@morganabel - I get this error in my project occasionally. I’ve disabled the build optimizer for now.

I’m getting a similar but slightly different error but it only started after changing form node 8 to 10

RangeError: Maximum call stack size exceeded
    at arrayClone (events.js:469:20)
    at process.emit (events.js:185:23)
    at process.EventEmitter.emit (domain.js:442:20)
    at process.emit (/node_modules/source-map-support/source-map-support.js:454:21)
    at _addListener (events.js:211:14)
    at process.prependListener [as __zone_symbol__prependListener] (events.js:266:14)
    at ZoneTask.customSchedulePrepend [as scheduleFn] (/node_modules/zone.js/dist/zone-node.js:1622:47)
    at ZoneDelegate.scheduleTask (/node_modules/zone.js/dist/zone-node.js:407:26)
    at Zone.scheduleTask (/node_modules/zone.js/dist/zone-node.js:232:43)
    at Zone.scheduleEventTask (/node_modules/zone.js/dist/zone-node.js:258:25)
error Command failed with exit code 1.
Angular CLI: 6.1.2
Node: 10.8.0
OS: darwin x64
Angular: 6.1.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.7.2
@angular-devkit/build-angular      0.7.2
@angular-devkit/build-optimizer    0.7.2
@angular-devkit/build-webpack      0.7.2
@angular-devkit/core               0.7.2
@angular-devkit/schematics         0.7.2
@angular/cdk                       6.4.2
@angular/cli                       6.1.2
@angular/material                  6.4.2
@angular/material-moment-adapter   6.4.2
@ngtools/webpack                   6.1.2
@schematics/angular                0.7.2
@schematics/update                 0.7.2
rxjs                               6.2.2
typescript                         2.9.2
webpack                            4.9.2

@dzonatan that is very interesting information, thank you for taking the time to identify what’s breaking. Will look at it 👍