-
Notifications
You must be signed in to change notification settings - Fork 12k
AOT build error Cannot read property 'kind' of undefined #8434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Same issue here with @angular/cli 1.5.0 Works without aot. |
Same here, except that it does not work either without AOT. Without AOT, it takes over 140 seconds to build, and throws the following error when actually running:
|
@Axure it builds successfully for me with |
I seem to have found out the problem. The problematic code there is:
It seems to fail to find the parent of the node when the node is a property declaration. I suddenly realized that it was the @select decorator from angular-redux, and I'm pretty sure the decorator is valid. So I tried adding the following line to bypass the check. |
Facing this issue with Angular Cli 1.5.2 Angular Version: 1.5.2 |
@arsyed04 - Yup was getting error with Angular Cli 1.5.2 but worked fine when rolled back to 1.5.0 Not sure if it's really needed but my TypeScript version was 2.6.1 |
My typescript version is also same "typescript": "^2.6.1" |
same error and my version is |
Same error with cli 1.5.2. Downgraded to 1.5.0 and it worked. @angular/cli: 1.5.2
|
Im having the same error since I use the md-bootstrap project. |
Getting same error. @angular/angular-cli 1.5.3 Running: Produces:
Edit: I've also narrowed it down to a specific decorator I'm using throughout my app. Removing the instances of the |
Same error. @angular/angular-cli 1.5.0 Running: |
I confirm erro still here with last release 1.5.4 / 1.6.0-rc.0 :
ps: I tried with ts 2.5.3 and with @niveo please fix your links when click ?? |
In my case, the error was caused by arrow functions used as parameters of decorators.
Then it was easy to replace those with named function
|
Huge THANK YOU! You are save my time :) |
I'm having the same problem and found it's because of arrow functions in decorators, like:
When I change the above to:
It compiles with AOT again =) |
typestack/class-transformer#108
|
Angular CLI: 1.5.4 I'm having an issue with a Using the above
Replacing the decorator with the timeout code in |
@MohammedYaseen I'm not sure, but probably using a custom github repo as registry for the dependency |
@Axure, Ok, thanks |
We are having the same problem and have been stuck on 1.5.0 because of it. In our case it happens even without arrow functions being passed to decorators The cause in our case is some decorators being applied to properties that also have Angular decorators (usually @input) applied to them. Everything works in JIT mode but AOT fails. Stepping through in the debugger we can see that the node's parent is gone and there is no null check to prevent it exploding (as mentioned above by another commenter). We will probably end up removing the custom decorators anyway (can't rely on decorators at all), but until then, we are stuck or will have to hack Typescript. Any news on whether this is being looked at? Would a PR to Typescript or the CLI be acceptable? |
@filipesilva @SanderElias here is a repro for this bug https://github.com/hccampos/angular-cli-repro-8434 |
In my case it turned out to be the fact that we were using 2 decorators on a function Our code was like this, which should work and is valid
Changing to below got rid of the error
|
@philjones88 where did you apply this workaround? Is it general fix? |
@arsyed04 I applied it to any usages of |
Same issue with |
issue with md-bootstrap is fixed with typescript 2.7.1 |
@morganster this issue is about --aot compilation |
It still broken it is not possible to build with: ng build --prod |
@front-end-developer: TypeScript 2.8.x is not yet supported. Please install a version that matches the Angular compiler's peer dependency: https://github.com/angular/angular/blob/5.2.10/packages/compiler-cli/package.json#L18 |
Thanks for this, now I ran: it installed: when i run ng build --prod: I changed it to: 2.7.0-rc Then i run ng build --prod:
|
So this fix worked for me: I had to do: npm rebuild node-sass So I ran the command from powershell as administrator: then I switch to a 32 bit node version: you can check your nvm version with the command: So that fixed that, then I ran: then tried to find a compatible typescript version that would not torment my production build: that fixed my issues. |
so the only error I am seeing now is: but this is manageable. |
I had same problem today.
...and I fix it just upgrading my Typescript for 2.6.2. |
These steps worked for me:
|
The problem might be in the Changed to |
I believe you missed type of chartist package. |
Same error in @angular/cli 7.3.0 when running 'ng serve --proxy-config proxy.conf.js --port 4500 -o':
It fails on rebuilding the project when changes are detected. Forcing a new rebuild (changing some code) use to build it correctly. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug Report or Feature Request (mark with an
x
)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
The text was updated successfully, but these errors were encountered: