Need more error info - " Cannot read property 'length' of undefined TypeError: Cannot read property 'length' of undefined "
Please provide us with the following information:
OS?
Windows 7
Versions.
node --version v 6.9.4 ng version angular-cli: 1.0.0-beta.25.5 node: 6.9.4 os: win32 x64 @angular/common: 2.4.8 @angular/compiler: 2.4.8 @angular/core: 2.4.8 @angular/forms: 2.4.8 @angular/http: 2.4.8 @angular/platform-browser: 2.4.8 @angular/platform-browser-dynamic: 2.4.8 @angular/router: 3.4.8 @angular/compiler-cli: 2.4.8
Repro steps.
https://github.com/ragulmathawa/cutom-ngx-charts
This is the git repo with code I tried.
The log given by the failure.
Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
at createSourceFile (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:8980:109)
at parseSourceFileWorker (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:8940:26)
at Object.parseSourceFile (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:8899:26)
at Object.createSourceFile (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:8727:29)
at WebpackCompilerHost.getSourceFile (c:\workspace\code\new\sample\node_modules\@ngtools\webpack\src\compiler_host.js:210:27)
at findSourceFile (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45859:29)
at processSourceFile (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45790:27)
at c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45901:17
at Object.forEach (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:1115:30)
at processReferencedFiles (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45899:16)
at findSourceFile (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45884:21)
at processImportedModules (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45994:25)
at findSourceFile (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45888:17)
at processImportedModules (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45994:25)
at findSourceFile (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45888:17)
at processImportedModules (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45994:25)
at findSourceFile (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45888:17)
at processImportedModules (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45994:25)
at findSourceFile (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45888:17)
at processImportedModules (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45994:25)
at findSourceFile (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45888:17)
at processImportedModules (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45994:25)
at findSourceFile (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45888:17)
at processImportedModules (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45994:25)
at findSourceFile (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45888:17)
at processSourceFile (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45790:27)
at processRootFile (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45694:13)
at c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45151:60
at Object.forEach (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:1115:30)
at Object.createProgram (c:\workspace\code\new\sample\node_modules\typescript\lib\typescript.js:45151:16)
at AotPlugin._setupOptions (c:\workspace\code\new\sample\node_modules\@ngtools\webpack\src\plugin.js:124:28)
at new AotPlugin (c:\workspace\code\new\sample\node_modules\@ngtools\webpack\src\plugin.js:23:14)
at Object.exports.getWebpackNonAotConfigPartial (c:\workspace\code\new\sample\node_modules\angular-cli\models\webpack-build-typescript.js:25:13)
at new NgCliWebpackConfig (c:\workspace\code\new\sample\node_modules\angular-cli\models\webpack-config.js:38:46)
at Class.run (c:\workspace\code\new\sample\node_modules\angular-cli\tasks\serve-webpack.js:23:22)
at c:\workspace\code\new\sample\node_modules\angular-cli\commands\serve.run.js:37:22
at process._tickCallback (internal/process/next_tick.js:103:7)
Mention any other details that might be useful.
The actual error seems to be triggered while importing LineSeriesComponent from ngx-charts module. I need to extend the LineSeriesComponent of the ngx-charts. Even though I didn't declare CustomLineSeriesComponent in app module declarations it shows error. So it must be triggered from import.
I have seen several issues with same error but for different cases. The error must detailed and the possible cause of undefined variable should be found.
Several issues were closed by downgrading the angular-cli but we need to know the exact reason to prevent future issues.
@klferreira could you please explain your way in more details thanks in advance
I solved this problem (error during refactoring test). All is good for angular v4.3.* and v4.4*
- Change @angular/cli" version 1.7.3 to 1.4.10 in package.json (latest for angular4)
rm -rf node_modulesnpm install --no-optional
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.