Ngx-charts: Error: Error on worker #1: RangeError: Maximum call stack size exceeded

Created on 10 Jun 2021  路  16Comments  路  Source: swimlane/ngx-charts

Describe the bug
After adding @angular/cdk 11.2.13 and ngx-charts to the project npm install does not work anymore.

To Reproduce
Steps to reproduce the behavior:

  1. npm install --save @angular/[email protected]
  2. npm install --save @swimlane/[email protected]
  3. npm install
  4. See error
Compiling @swimlane/ngx-charts : es2015 as esm2015
Compiling @swimlane/ngx-charts : main as umd
Error: Error on worker #1: RangeError: Maximum call stack size exceeded
    at resolveNameHelper (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/typescript/lib/typescript.js:44875:35)
    at resolveName (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/typescript/lib/typescript.js:44873:20)
    at resolveEntityName (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/typescript/lib/typescript.js:46147:42)
    at getSymbolOfNameOrPropertyAccessExpression (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/typescript/lib/typescript.js:77578:28)
    at getSymbolAtLocation (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/typescript/lib/typescript.js:77647:28)
    at Object.getSymbolAtLocation (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/typescript/lib/typescript.js:43738:31)
    at UmdReflectionHost.findUmdImportParameter (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/@angular/compiler-cli/ngcc/src/host/umd_host.js:341:45)
    at UmdReflectionHost.getImportPathFromParameter (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/@angular/compiler-cli/ngcc/src/host/umd_host.js:424:40)
    at UmdReflectionHost.getUmdModuleDeclaration (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/@angular/compiler-cli/ngcc/src/host/umd_host.js:412:35)
    at UmdReflectionHost.getDeclarationOfIdentifier (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/@angular/compiler-cli/ngcc/src/host/umd_host.js:54:70)
    at ClusterMaster.onWorkerMessage (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:195:27)
    at /home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:55:95
    at ClusterMaster.<anonymous> (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:293:57)
    at step (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/tslib/tslib.js:143:27)
    at Object.next (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/tslib/tslib.js:124:57)
    at /home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/tslib/tslib.js:113:16)
    at EventEmitter.<anonymous> (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:287:32)
    at EventEmitter.emit (events.js:376:20)

Additional Information
I found a similar bug report for another @swimlane project (@swimlane/ngx-datatable), probably both are related to each other:
https://github.com/swimlane/ngx-datatable/issues/1676

Bug

All 16 comments

Hi, I've got the same problem, with Angular 12.0.4...

Same problem... took me ages to track down the culprit!

Same here :

"@angular/animations": "^12.0.0",
"@angular/cdk": "^12.0.4",
"@angular/common": "^12.0.0",
"@angular/compiler": "^12.0.0",
"@angular/core": "^12.0.0",
"@angular/forms": "^12.0.0",
"@angular/material": "^12.0.4",
"@angular/platform-browser": "^12.0.0",
"@angular/platform-browser-dynamic": "^12.0.0",
"@angular/router": "^12.0.0",
"@swimlane/ngx-charts": "^18.0.1",

The only workaround that worked for now is :

  • Remove @swimlane/ngx-charts from package.json dependencies
  • run npm install
  • run npm install @swimlane/ngx-charts

Same problem here. The only thing that worked for me was to create a ngcc.config.js file as suggested by _d-rybachuk_ in issue #1623. I hope they release a fix for this soon.

Same problem here, this looks critical indeed, I just installed this package, looked pretty cool, but it crash in my pipelines as npm i will always fail... but yeah duplicate of #1623

There any updates for this? Bypassing ngcc isn't a fix.

Same issue for me too, took ages to track this down. Going back to ngx-charts 17.0.1 worked around the issue for me so it is at least possible to build clean, but 18.0.1 was a definite no-go.

+1

+1

The ngcc.confige hack is not a fix, as those modules are part of testing. Bypassing the umd builds makes jest unable to find the module and fails with no solution.

issue still present after upgrading to version 19.0.0

added ngcc.config.js to root folder (as mentioned earlier) to "solve" the issue, containing:

module.exports = {
    packages: {
        '@swimlane/ngx-charts': {
            entryPoints: {
                '.': { override: { main: undefined } },
            },
        },
    },
};

Thanks @neffsvg - saved me some time testing...

This is now really annoying because we can't upgrade our Angular version until this issue is fixed. Something must have changed in the package build process to cause this. Does anyone know what specifically is missing in the npm package that causes it to break?

Cheers

Is anyone able to create a repository where this can be reproduced, please? I'm having trouble reproducing it.

@marjan-georgiev https://github.com/Hypercubed/ngcc_error/tree/main

Throws the error when running npx ngcc

Hi @marjan-georgiev,

I'm using
Angular CLI: 12.0.5
Node: 14.17.5
Package Manager: npm 6.14.14
OS: win32 x64
typescript: 4.2.4
(I do not thing the versions are important - I had similar behavior with other versions)

here are the steps to reproduce the error on a minimal setup:

  1. ng new test-ngx-charts
    cd test-ngx-charts
  2. edit package.json
    add to stripts:
    "postinstall": "ngcc"
    add to dependencies:
    "@angular/cdk": "~12.0.1",
    "@swimlane/ngx-charts": "~19.0.0"
  3. npm install
    => produces the error:
    Compiling @swimlane/ngx-charts : main as umd
    Error: Error on worker #1: RangeError: Maximum call stack size exceeded
    ....

Thanks for looking into the error!

Fixed for me with 19.0.1 thanks

Working.
Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ronybarbosa picture ronybarbosa  路  3Comments

amcdnl picture amcdnl  路  4Comments

Hypercubed picture Hypercubed  路  3Comments

workfel picture workfel  路  3Comments

DZDomi picture DZDomi  路  4Comments