最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Cannot read property 'kind' of undefined - Stack Overflow

programmeradmin6浏览0评论

run the my project

ng build --prod --base-href="./"

getting below error message

ERROR in ./node_modules/ng-multiselect-dropdown/fesm2015/ng-multiselect-dropdown.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 (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:265:35)
    at checkNodeForDecorators (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:77:21)
    at visitNodes (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16514:30)
    at Object.forEachChild (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16740:24)
    at checkNodeForDecorators (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
    at visitNode (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16505:24)
    at Object.forEachChild (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16635:21)
    at checkNodeForDecorators (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
    at visitNode (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16505:24)
    at Object.forEachChild (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16703:24)
    at checkNodeForDecorators (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
    at visitNode (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16505:24)
    at Object.forEachChild (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16692:24)
    at checkNodeForDecorators (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
    at visitNode (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16505:24)
    at Object.forEachChild (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16599:21)

run the my project

ng build --prod --base-href="./"

getting below error message

ERROR in ./node_modules/ng-multiselect-dropdown/fesm2015/ng-multiselect-dropdown.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 (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:265:35)
    at checkNodeForDecorators (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:77:21)
    at visitNodes (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16514:30)
    at Object.forEachChild (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16740:24)
    at checkNodeForDecorators (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
    at visitNode (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16505:24)
    at Object.forEachChild (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16635:21)
    at checkNodeForDecorators (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
    at visitNode (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16505:24)
    at Object.forEachChild (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16703:24)
    at checkNodeForDecorators (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
    at visitNode (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16505:24)
    at Object.forEachChild (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16692:24)
    at checkNodeForDecorators (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
    at visitNode (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16505:24)
    at Object.forEachChild (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16599:21)
Share Improve this question edited Nov 4, 2019 at 13:52 daan.desmedt 3,8201 gold badge21 silver badges33 bronze badges asked Nov 4, 2019 at 13:51 gayathri bindelagayathri bindela 591 gold badge2 silver badges5 bronze badges 3
  • 2 Does this answer your question? TypeError: Cannot read property 'kind' of undefined at getAssignmentTargetKind – Prashant Pimpale Commented Nov 4, 2019 at 13:53
  • do you solve this problem. I m having the same issue, when i m trying to build newly created library – Shameera Anuranga Commented Dec 2, 2019 at 10:07
  • Does this answer your question? Cannot read property 'kind' of undefined while publish angular+ core project in CI-CD azure devops – Leponzo Commented Aug 23, 2022 at 19:53
Add a ment  | 

4 Answers 4

Reset to default 7

Not a permanent solution, but I was getting this in production only with datepicker. I went to the production configuration in angular.json and changed buildOptimizer to false.

I found it really hard to find information about this error for library builders, so I'm posting it here. We can't just tell the users to upgrade their Angular's versions or disable build optimization.

For a library to work well with versions 6 and 7 of @angular/cli, you must export all decorators metadata when building the library. To do that, add the following to the tsconfig.json of your lib:

"pilerOptions": {
  "emitDecoratorMetadata": true
}

Downgrading the version of ng-multiselect-dropdown to 0.2.3 might solve the issue.

Just remove the caret ^ symbol from the package i.e.

"ng-multiselect-dropdown": "^0.2.3" to "ng-multiselect-dropdown": "0.2.3"

Resolved my issue.

发布评论

评论列表(0)

  1. 暂无评论