Cannot read property ‘length’ of undefined

Cannot read property ‘length’ of undefined
at lineCounter (/Users/www/repository/parcel-demo/node_modules/_parcel-bundler@1.12.3@parcel-bundler/src/utils/lineCounter.js:3:30)
at JSPackager.writeModule (/Users/www/repository/parcel-demo/node_modules/_parcel-bundler@1.12.3@parcel-bundler/src/packagers/JSPackager.js:127:60)
at

2 thoughts on “Cannot read property ‘length’ of undefined

  1. FYI to solve I deleted .cache directory. Ran parcel src/index.html -t node, stopped running, and then ran my regular parcel src/index.html.

Cannot read property ‘length’ of undefined

I got an error when use the pie chart,here is the stack:
TypeError: Cannot read property ‘length’ of undefined
at t.isMsResolutionNeeded (http://localhost:3000/public/build/app.dfabdd44b3be44288eac.js:1:165399)
at new t (http://localhost:3000/public/build/app.dfabdd44b3be44288eac.js:1:162236)
at PieChartCtrl.seriesHandler (http://localhost:3000/public/plugins/grafana-piechart-panel/piechart_ctrl.js:175:26)
at Array.map ()
at PieChartCtrl.onDataReceived (http://localhost:3000/public/plugins/grafana-piechart-panel/piechart_ctrl.js:168:36)
at s.emit (http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:86:11360)
at t.emit (http://localhost:3000/public/build/app.dfabdd44b3be44288eac.js:1:181443)
at PieChartCtrl.e.handleQueryResult (http://localhost:3000/public/build/app.dfabdd44b3be44288eac.js:22:485969)
at http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:92198
at http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:92295

And i use the latest plugin version( V1.3.4), but the pie is worked fine on Kibina,here is the response of elasticsearch:

“xhrStatus”: “complete”,
“request”: {
“method”: “POST”,
“url”: “api/datasources/proxy/1/_msearch”,
“data”: “{“search_type”:”query_then_fetch”,”ignore_unavailable”:true,”index”:”trade_info”,”max_concurrent_shard_requests”:256}\n{“size”:0,”query”:{“bool”:{“filter”:[{“range”:{“createTime”:{“gte”:”1537240072264″,”lte”:”1537293973068″,”format”:”epoch_millis”}}},{“query_string”:{“analyze_wildcard”:true,”query”:”*”}}]}},”aggs”:{“2”:{“terms”:{“field”:”merId”,”size”:10,”order”:{“1″:”desc”},”min_doc_count”:1},”aggs”:{“1”:{“sum”:{“field”:”orderAmt”}}}}}}\n”
},
“response”: {
“responses”: [
{
“took”: 3,
“timed_out”: false,
“_shards”: {
“total”: 5,
“successful”: 5,
“skipped”: 0,
“failed”: 0
},
“hits”: {
“total”: 176638,
“max_score”: 0,
“hits”: []
},
“aggregations”: {
“2”: {
“doc_count_error_upper_bound”: -1,
“sum_other_doc_count”: 129547,
“buckets”: [
{
“1”: {
“value”: 5367610771
},
“key”: “929000095022319”,
“doc_count”: 28431
},
{
“1”: {
“value”: 1336861082
},
“key”: “929000000000030”,
“doc_count”: 94
},
{
“1”: {
“value”: 826134238
},
“key”: “929030000084035”,
“doc_count”: 1993
},
{
“1”: {
“value”: 816355698
},
“key”: “929000000000017”,
“doc_count”: 1411
},
{
“1”: {
“value”: 700609508
},
“key”: “929000095023982”,
“doc_count”: 2137
},
{
“1”: {
“value”: 684607153
},
“key”: “929000095024067”,
“doc_count”: 2576
},
{
“1”: {
“value”: 684258329
},
“key”: “929000095025226”,
“doc_count”: 3882
},
{
“1”: {
“value”: 680390156
},
“key”: “929000095023983”,
“doc_count”: 2768
},
{
“1”: {
“value”: 677006425
},
“key”: “929000095024069”,
“doc_count”: 2685
},
{
“1”: {
“value”: 651594621
},
“key”: “929040095022686”,
“doc_count”: 1114
}
]
}
},
“status”: 200
}
]
}
}

1 possible answer(s) on “Cannot read property ‘length’ of undefined

Cannot read property ‘length’ of undefined

  1. MacOS Sierra 10.12.3

@angular/cli: 1.0.0-beta.32.3 [1.0.0-beta.17] node: 7.4.0 os: darwin x64 @angular/common: 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/cli: 1.0.0-beta.32.3 @angular/compiler: 2.4.8 @angular/compiler-cli: 2.4.8 @angular/platform-server: 2.4.8 @ngtools/webpack: 1.2.4

  1. App was created using old cli angular-cli (I have taken the steps to upgrade including uninstalling globally, removing node_modules, etc)
    Converting existing production Angular 2 application to compile using AOT using the following doc: https://angular.io/docs/ts/latest/cookbook/aot-compiler.html#!#bootstrap
    I can successfully compile without errors now running node_modules/.bin/ngc -p tsconfig-aot.json
    Trying to make this work with angular cli, recently upgraded packages and cli. Tried uninstalling, cleaning npm cache, uninstalling global packages, etc.

Cannot read property 'length' of undefined TypeError: Cannot read property 'length' of undefined at createSourceFile (/node_modules/@angular/cli/node_modules/typescript/lib/typescript.js:14552:109) at parseSourceFileWorker (/node_modules/@angular/cli/node_modules/typescript/lib/typescript.js:14484:26) at Object.parseSourceFile (/node_modules/@angular/cli/node_modules/typescript/lib/typescript.js:14433:26) at Object.createSourceFile (/node_modules/@angular/cli/node_modules/typescript/lib/typescript.js:14288:29) at new TypeScriptFileRefactor (/node_modules/@angular/cli/node_modules/@ngtools/webpack/src/refactor.js:30:35) at Object.resolveEntryModuleFromMain (/node_modules/@angular/cli/node_modules/@ngtools/webpack/src/entry_resolver.js:104:20) at AotPlugin._setupOptions (/node_modules/@angular/cli/node_modules/@ngtools/webpack/src/plugin.js:135:50) at new AotPlugin (/node_modules/@angular/cli/node_modules/@ngtools/webpack/src/plugin.js:22:14) at _createAotPlugin (/node_modules/@angular/cli/models/webpack-configs/typescript.js:54:12) at Object.exports.getNonAotConfig (/node_modules/@angular/cli/models/webpack-configs/typescript.js:80:13) at new NgCliWebpackConfig (/node_modules/@angular/cli/models/webpack-config.js:24:37) at Class.run (/node_modules/@angular/cli/tasks/build.js:24:31) at Class.run (/node_modules/@angular/cli/commands/build.js:63:26) at Class.<anonymous> (/node_modules/@angular/cli/ember-cli/lib/models/command.js:134:17) at process._tickCallback (internal/process/next_tick.js:103:7)

angular-cli.json
{ "project": { "version": "1.0.0-beta.17", "name": "" }, "apps": [ { "root": "src", "outDir": "public", "assets": ["assets"], "index": "index.html", "main": "src/main.ts", "test": "test.ts", "tsconfig": "tsconfig.json", "prefix": "app", "mobile": false, "styles": [ "styles.scss" ], "scripts": [], "environmentSource": "environments/environment.qa.ts", "environments": { "source": "environments/environment.ts", "dev": "environments/environment.ts", "qa": "environments/environment.qa.ts", "prod": "environments/environment.prod.ts" } } ], "addons": [], "packages": [], "e2e": { "protractor": { "config": "./protractor.conf.js" } }, "test": { "karma": { "config": "./karma.conf.js" } }, "defaults": { "styleExt": "sass", "prefixInterfaces": false } }
tsconfig-aot.json
`{
“compilerOptions”: {
“target”: “es5”,
“module”: “es2015”,
“moduleResolution”: “node”,
“sourceMap”: true,
“emitDecoratorMetadata”: true,
“experimentalDecorators”: true,
“lib”: [“es2015”, “dom”],
“noImplicitAny”: true,
“suppressImplicitAnyIndexErrors”: true,
“outDir”: “../dist/out-aot”
},

“files”: [
“app/app.module.ts”,
“main.ts”
],

“angularCompilerOptions”: {
“genDir”: “aot”,
“skipMetadataEmit” : true
}
}
tsconfig.json{
“compilerOptions”: {
“declaration”: false,
“emitDecoratorMetadata”: true,
“experimentalDecorators”: true,
“lib”: [“es6”, “dom”],
“mapRoot”: “./”,
“module”: “es6”,
“moduleResolution”: “node”,
“outDir”: “../dist/out-tsc”,
“sourceMap”: true,
“target”: “es5”,
“typeRoots”: [
“../node_modules/@types
]
}
}`


Thanks! We’ll be in touch soon.

2 thoughts on “Cannot read property ‘length’ of undefined