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.

V 2.1.0: TypeError: Cannot read property 'kind' of undefined

See original GitHub issue

when running

ng build --prod

with this set of packages

{
  "name": "create",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "startWithProxy": "ng serve --host 0.0.0.0 --disableHostCheck true --proxy-config proxy.config.json",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^8.2.14",
    "@angular/cdk": "^8.2.3",
    "@angular/common": "~8.2.14",
    "@angular/compiler": "~8.2.14",
    "@angular/core": "~8.2.14",
    "@angular/flex-layout": "^8.0.0-beta.27",
    "@angular/forms": "~8.2.14",
    "@angular/material": "^8.2.3",
    "@angular/material-moment-adapter": "^8.2.3",
    "@angular/platform-browser": "~8.2.14",
    "@angular/platform-browser-dynamic": "~8.2.14",
    "@angular/router": "~8.2.14",
    "@ng-bootstrap/ng-bootstrap": "^5.1.4",
    "ajv": "^6.10.2",
    "angularx-qrcode": "^2.1.0",
    "core-js": "^3.6.1",
    "hammerjs": "^2.0.8",
    "moment": "^2.24.0",
    "ngx-color-picker": "^8.2.0",
    "rxjs": "^6.5.4",
    "tslib": "^1.9.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.800.6",
    "@angular/cli": "~8.0.6",
    "@angular/compiler-cli": "~8.2.14",
    "@angular/language-service": "~8.0.3",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "^2.0.8",
    "@types/node": "~8.9.4",
    "codelyzer": "^5.2.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^2.0.6",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.4.5"
  }
}

This error happens

ERROR in ./node_modules/angularx-qrcode/fesm5/angularx-qrcode.js
Module build failed (from ./node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js):
TypeError: Cannot read property 'kind' of undefined
    at isAngularDecoratorMetadataExpression (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:265:35)
    at checkNodeForDecorators (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:77:21)
    at visitNodes (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16514:30)
    at Object.forEachChild (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16740:24)
    at checkNodeForDecorators (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
    at visitNode (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16505:24)
    at Object.forEachChild (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16635:21)
    at checkNodeForDecorators (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
    at visitNode (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16505:24)
    at Object.forEachChild (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16692:24)
    at checkNodeForDecorators (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
    at visitNode (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16505:24)
    at Object.forEachChild (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16703:24)
    at checkNodeForDecorators (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
    at visitNode (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16505:24)
    at Object.forEachChild (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16599:21)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:17 (5 by maintainers)

github_iconTop GitHub Comments

6reactions
Cordobocommented, Jan 1, 2020

Ok, what I’ve read so far, it could be an issue with an older @angular dependency (1) used in your package.json. I run ng build --prod with the following devDependencies and can’t reproduce the error. Coiuld you try updating your dependencies to the ones below?

"devDependencies": {
    "@angular-devkit/build-angular": "~0.803.21",
    "@angular-devkit/build-ng-packagr": "~0.803.21",
    "@angular/cli": "~8.3.21",
    "@angular/compiler-cli": "~8.2.14",
    "@angular/language-service": "~8.2.14",
...
}
  1. Reference: https://github.com/angular/angular-cli/pull/15705
4reactions
lance-hcommented, Jan 15, 2020

@nicosoutn2014 I am using @angular/cli ^7.2.2 - I downgraded angularx-qrcode to ^1.6.4 which removed the issue for me. Be aware that the documentation is slightly different between versions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'kind' of undefined at ...
This is an issue related to the Angular devkit and build optimizer and has to do with version mismatches. I ran into this...
Read more >
TypeError: Cannot read property 'kind' of undefined · Issue ...
@elibarzilay try to change the typescript version to the latest in package.json before installing.
Read more >
angular/angular-cli - Gitter
Any reason why you can't move it to angular. ... And publish a minor hacked version of the ... TypeError: Cannot read property...
Read more >
cannot read properties of undefined (reading 'map') angular
results in data.results is probably undefined , check that the data object matches the schema you're expecting it to. Open side panel.
Read more >
Ionic 3.x Unable to build using the --prod "TypeError
TypeError : Cannot read property 'kind' of undefined at ... Xcode : Xcode 9.4.1 Build version 9F2000 Environment Variables: ANDROID_HOME ...
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