TypeError: Cannot read property 'kind' of

2020-07-02 08:10发布

This problem started to occur when updating my Angular 6 project to 7.x.

I opened an issue on the angular-cli github repo but they couldn't help.

So what I did is create a new project and add all components one by one to "hopefully" notice what caused the problem.

Unfortunately I couldn't identify the problem. Here's the log:

ERROR in : TypeError: Cannot read property 'kind' of undefined
at getAssignmentTargetKind (E:\McClient\node_modules\typescript\lib\typescript.js:10049:28)
at Object.isAssignmentTarget (E:\McClient\node_modules\typescript\lib\typescript.js:10092:16)
at checkObjectLiteral (E:\McClient\node_modules\typescript\lib\typescript.js:46107:45)
at checkExpressionWorker (E:\McClient\node_modules\typescript\lib\typescript.js:50748:28)
at checkExpression (E:\McClient\node_modules\typescript\lib\typescript.js:50696:42)
at checkExpressionWithContextualType (E:\McClient\node_modules\typescript\lib\typescript.js:50524:26)
at checkApplicableSignature (E:\McClient\node_modules\typescript\lib\typescript.js:47963:35)
at chooseOverload (E:\McClient\node_modules\typescript\lib\typescript.js:48281:26)
at resolveCall (E:\McClient\node_modules\typescript\lib\typescript.js:48231:26)
at resolveCallExpression (E:\McClient\node_modules\typescript\lib\typescript.js:48534:20)
at resolveSignature (E:\McClient\node_modules\typescript\lib\typescript.js:48800:28)
at getResolvedSignature (E:\McClient\node_modules\typescript\lib\typescript.js:48844:26)
at checkCallExpression (E:\McClient\node_modules\typescript\lib\typescript.js:48936:29)
at checkExpressionWorker (E:\McClient\node_modules\typescript\lib\typescript.js:50759:28)
at checkExpression (E:\McClient\node_modules\typescript\lib\typescript.js:50696:42)
at resolveDecorator (E:\McClient\node_modules\typescript\lib\typescript.js:48741:28)

Here's a link to the github issue with logs from a checkSourcefile function I was supposed to log:

https://github.com/angular/angular-cli/issues/13172

How can I track down and (hopefully) fix what's causing this?

Edit: My ng --version info

Angular CLI: 7.1.3
Node: 8.11.4
OS: win32 x64
Angular: 7.1.3
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.11.3
@angular-devkit/build-angular     0.11.3
@angular-devkit/build-optimizer   0.11.3
@angular-devkit/build-webpack     0.11.3
@angular-devkit/core              7.1.3
@angular-devkit/schematics        7.1.3
@angular/cdk                      7.1.1
@ngtools/webpack                  7.1.3
@schematics/angular               7.1.3
@schematics/update                0.11.3
rxjs                              6.3.3
typescript                        3.1.6
webpack                           4.23.1

9条回答
▲ chillily
2楼-- · 2020-07-02 08:55
  • I was having issue with while migrating ionic application from V4 to V5.
  • This is my error log image.

enter image description here

  • It was fixed with the below solution.

https://github.com/ckeditor/ckeditor4-angular/issues/78#issuecomment-565803253

查看更多
看我几分像从前
3楼-- · 2020-07-02 09:00

I also had this problem. I solved it by updating my local @angular/cli to the same version as the @anguluar/cli version in my project .

查看更多
Animai°情兽
4楼-- · 2020-07-02 09:00

It solved from version

npm i @angular-devkit/build-angular@0.803.7 -s

check this https://www.npmjs.com/package/@angular-devkit/build-angular

查看更多
地球回转人心会变
5楼-- · 2020-07-02 09:01

In my case the problem was that I had abstract classes with @Injectable, removing it solved the issue.

Hopes it helps

查看更多
看我几分像从前
6楼-- · 2020-07-02 09:02

This Problem can be solved by restarting:

Use ng serve

查看更多
老娘就宠你
7楼-- · 2020-07-02 09:04

I simply re-run

    ng serve

again and it worked!

查看更多
登录 后发表回答