question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ngx-charts causes 'Cannot read property 'length' of undefined' with angular-cli beta.30

See original GitHub issue

I’m submitting a … (check one with “x”)

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here

Current behavior

ngx-charts@4.1.x causes the following error with @angular/angular-cli@1.0.0-beta.31 in combination with the peer dependency @ngtools/webpack@>1.2.4 (with @ngtools/webpack@1.2.4 installed as dev-dependency it still works without errors).

Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
    at createSourceFile (...\node_modules\typescript\lib\typescript.js:14552:109)
    at parseSourceFileWorker (...\node_modules\typescript\lib\typescript.js:14484:26)
    at Object.parseSourceFile (...\node_modules\typescript\lib\typescript.js:14433:26)
    at Object.createSourceFile (...\node_modules\typescript\lib\typescript.js:14288:29)
    at WebpackCompilerHost.getSourceFile (...\node_modules\@ngtools\webpack\src\compiler_host.js:209:27)
    at findSourceFile (...\node_modules\typescript\lib\typescript.js:63453:29)
    at processSourceFile (...\node_modules\typescript\lib\typescript.js:63384:27)
    at ...\node_modules\typescript\lib\typescript.js:63494:17
    at Object.forEach (...\node_modules\typescript\lib\typescript.js:1293:30)
    at processReferencedFiles (...\node_modules\typescript\lib\typescript.js:63492:16)
    at findSourceFile (...\node_modules\typescript\lib\typescript.js:63477:21)
    at processImportedModules (...\node_modules\typescript\lib\typescript.js:63600:25)
    at findSourceFile (...\node_modules\typescript\lib\typescript.js:63481:17)
    at processImportedModules (...\node_modules\typescript\lib\typescript.js:63600:25)
    at findSourceFile (...\node_modules\typescript\lib\typescript.js:63481:17)
    at processSourceFile (...\node_modules\typescript\lib\typescript.js:63384:27)
    at processRootFile (...\node_modules\typescript\lib\typescript.js:63271:13)
    at ...\node_modules\typescript\lib\typescript.js:62620:60
    at Object.forEach (...\node_modules\typescript\lib\typescript.js:1293:30)
    at Object.createProgram (...\node_modules\typescript\lib\typescript.js:62620:16)
    at AotPlugin._setupOptions (...\node_modules\@ngtools\webpack\src\plugin.js:111:28)
    at new AotPlugin (...\node_modules\@ngtools\webpack\src\plugin.js:21:14)
    at _createAotPlugin (...\node_modules\@angular\cli\models\webpack-configs\typescript.js:28:12)
    at Object.exports.getNonAotConfig (...\node_modules\@angular\cli\models\webpack-configs\typescript.js:55:13)
    at new NgCliWebpackConfig (...\node_modules\@angular\cli\models\webpack-config.js:24:37)
    at Class.run (...\node_modules\@angular\cli\tasks\serve.js:33:29)
    at checkExpressPort.then.then (...\node_modules\@angular\cli\commands\serve.js:84:26)
    at process._tickCallback (internal/process/next_tick.js:103:7)

might be related to:

Expected behavior

ngx-charts not causing the error 😉

Reproduction of the problem

Using @angular/angular-cli@1.0.0-beta.31 with ngx-charts@4.1.1 As soon as I remove ngx-charts from my package.json the error does not occur while compiling/building with ng serve

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

Please tell us about your environment:

Windows 10 VS Code yarn / npm

  • ngx-charts version: x.x.x
                             _                           _  _
  __ _  _ __    __ _  _   _ | |  __ _  _ __         ___ | |(_)
 / _` || '_ \  / _` || | | || | / _` || '__|_____  / __|| || |
| (_| || | | || (_| || |_| || || (_| || |  |_____|| (__ | || |
 \__,_||_| |_| \__, | \__,_||_| \__,_||_|          \___||_||_|
               |___/
@angular/cli: 1.0.0-beta.31
node: 6.9.5
os: win32 x64
@angular/common: 2.4.7
@angular/compiler: 2.4.7
@angular/core: 2.4.7
@angular/flex-layout: 2.0.0-beta.4
@angular/forms: 2.4.7
@angular/http: 2.4.7
@angular/material: 2.0.0-beta.1
@angular/platform-browser: 2.4.7
@angular/platform-browser-dynamic: 2.4.7
@angular/router: 3.4.7
@angular/cli: 1.0.0-beta.31
@angular/compiler-cli: 2.4.7
@angular/tsc-wrapped: 0.5.2

typescript: 2.0.3 or 2.1.6
  • Angular version: 2.x.x
  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
  • Language: [all | TypeScript X.X | ES6/7 | ES5]

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:23 (4 by maintainers)

github_iconTop GitHub Comments

9reactions
simonmlewiscommented, Sep 9, 2017

I found my issue here was moving from a bar chart to a line chart.

I expected my data to be able to stay the same.

It looks like for bar chart this is fine: [ { “value”: 6581, “name”: “2016-09-17T16:44:36.551Z” }, { “value”: 4853, “name”: “2016-09-20T12:24:27.430Z” },

BUT then for a line chart the series is required: [ { “name”: “Somalia”, “series”: [ { “value”: 6581, “name”: “2016-09-17T16:44:36.551Z” }, { “value”: 4853, “name”: “2016-09-20T12:24:27.430Z” },

I love these graphs but the documentation and example code could do with some input.

Thanks for the effort though guys.

5reactions
hanslcommented, Feb 11, 2017

I’m going to take a look into the Angular-CLI as well. This might be a failure on our part for some code analysis part.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ngx-charts : Cannot read property length of undefined
You are using angular-cli beta, so if we assume that you haven't update angular dependencies you are still on angular version 2.
Read more >
ERROR in Cannot read property 'length&#38
Hi,. i just tried to migrate to Angular 9 and followed the Instruction. But getting this mistake: ERROR in Cannot read property 'length'...
Read more >
angular/angular-cli - Gitter
I somehow had angular-cli left over in my deps ... Installed cli beta 31. ... Module build failed: TypeError: Cannot read property 'kind'...
Read more >
cannot read properties of undefined (reading 'injectable')
bn-ng-idle.mjs:32 Uncaught TypeError: Cannot read properties of undefined (reading ... (inline.bundle.js:55:30) at eval (app.module.ts:20:1) at .
Read more >
What's new - Radzen
(Blazor) Fixed DataGrid EmptyText causes ParameterView instance exception in MAUI. ... closeAllPopups() 'Cannot read properties of undefined' error.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found