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.

AOT build error Cannot read property 'kind' of undefined

See original GitHub issue

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

Angular CLI: 1.5.0 Node: 8.5.0 OS: darwin x64 Angular: 5.0.1 … animations, common, compiler, compiler-cli, core, forms … http, language-service, platform-browser … platform-browser-dynamic, router

@angular/cdk: 5.0.0-rc0 @angular/cli: 1.5.0 @angular/flex-layout: 2.0.0-beta.10-4905443 @angular/material: 5.0.0-rc0 @angular-devkit/build-optimizer: 0.0.32 @angular-devkit/core: 0.0.20 @angular-devkit/schematics: 0.0.35 @ngtools/json-schema: 1.1.0 @ngtools/webpack: 1.8.0 @schematics/angular: 0.1.2 typescript: 2.4.2 webpack-bundle-analyzer: 2.9.1 webpack: 3.8.1

Repro steps.

rm -rf node_modules/ yarn add @angular/cli@latest -D ng build --aot

The log given by the failure.

ERROR in Error: TypeError: Cannot read property 'kind' of undefined at nodeCanBeDecorated (/Users/sam/Developer/ng-prime/node_modules/typescript/lib/typescript.js:7805:35) at nodeIsDecorated (/Users/sam/Developer/ng-prime/node_modules/typescript/lib/typescript.js:7825:16) at Object.nodeOrChildIsDecorated (/Users/sam/Developer/ng-prime/node_modules/typescript/lib/typescript.js:7829:16) at isDecoratedClassElement (/Users/sam/Developer/ng-prime/node_modules/typescript/lib/typescript.js:51668:23) at isInstanceDecoratedClassElement (/Users/sam/Developer/ng-prime/node_modules/typescript/lib/typescript.js:51659:20) at Object.filter (/Users/sam/Developer/ng-prime/node_modules/typescript/lib/typescript.js:1652:25) at getDecoratedClassElements (/Users/sam/Developer/ng-prime/node_modules/typescript/lib/typescript.js:51641:23) at generateClassElementDecorationExpressions (/Users/sam/Developer/ng-prime/node_modules/typescript/lib/typescript.js:51815:27) at addClassElementDecorationStatements (/Users/sam/Developer/ng-prime/node_modules/typescript/lib/typescript.js:51804:44) at visitClassDeclaration (/Users/sam/Developer/ng-prime/node_modules/typescript/lib/typescript.js:51131:13) at visitTypeScript (/Users/sam/Developer/ng-prime/node_modules/typescript/lib/typescript.js:50972:28) at visitorWorker (/Users/sam/Developer/ng-prime/node_modules/typescript/lib/typescript.js:50785:24) at sourceElementVisitorWorker (/Users/sam/Developer/ng-prime/node_modules/typescript/lib/typescript.js:50817:28) at saveStateAndInvoke (/Users/sam/Developer/ng-prime/node_modules/typescript/lib/typescript.js:50738:27) at sourceElementVisitor (/Users/sam/Developer/ng-prime/node_modules/typescript/lib/typescript.js:50799:20) at visitNodes (/Users/sam/Developer/ng-prime/node_modules/typescript/lib/typescript.js:49280:48)

Desired functionality.

AOT build should be successful

Mention any other details that might be useful.

The project built fine with AOT enabled with CLI v1.4.9

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:40
  • Comments:63 (13 by maintainers)

github_iconTop GitHub Comments

22reactions
samalexandercommented, Nov 15, 2017

@Axure it builds successfully for me with ng build --prod --aot=false

15reactions
ericmarcoscommented, Nov 24, 2017

I’m having the same problem and found it’s because of arrow functions in decorators, like:

@Type(() => Message)

When I change the above to:

function m() { return Message; }
@Type(m)

It compiles with AOT again =)

Read more comments on GitHub >

github_iconTop Results From Across the Web

ng build error in cannot read property 'kind' of undefined
I have nodejs installed, I have the angular cli installed, typescript, I have run npm update, I keep getting this error, but there...
Read more >
Angular 8 Webpack Aot Build Failed - Cannot Read Property ...
6 and we got the error: Uncaught TypeError: Cannot read property 'type' of Angular Ngrx 8 Selector error: Cannot read property 'map' of...
Read more >
angular/angular-cli - Gitter
I'm tryin' to build project, but this error occurs: TypeError: Cannot read property 'kind' of undefined at isAngularDecoratorMetadataExpression ...
Read more >
Ionic5 prod build fails - Ionic Forum
js): TypeError: Cannot read property 'kind' of undefined at isAngularDecoratorMetadataExpression (/Users/lucascrivelli/Desktop/APP/ionic/ ...
Read more >
ERROR in Cannot read property 'length&#38
Can you give more information about this: ERROR in Cannot read property 'length' of undefined ? Try to update "screenfull": "^3.3.0" to latest...
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