angular-cli: Keep getting this error: Cannot read property 'kind' of undefined

Bug Report or Feature Request (mark with an x)

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

Command (mark with an x)

- [ ] new
- [ ] build
- [x ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

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

Package Version

@angular-devkit/architect 0.11.2 @angular-devkit/build-angular 0.11.2 @angular-devkit/build-optimizer 0.11.2 @angular-devkit/build-webpack 0.11.2 @angular-devkit/core 7.1.2 @angular-devkit/schematics 7.1.2 @angular/cdk 7.1.1 @ngtools/webpack 7.1.2 @schematics/angular 7.1.2 @schematics/update 0.11.2 rxjs 6.3.3 typescript 3.1.6 webpack 4.23.1

Repro steps

Happens many times a day when saving a file and the cli re-compiles

The log given by the failure

Failed to compile.

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

Desired functionality

No errors

Details: This started when Angular 7 was released. Unfortunately I wasn’t able to find much information about this issue. Neither on Stackoverflow nor in the issue trackers. Well at least not since the release of Angular 7

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 17
  • Comments: 35 (1 by maintainers)

Most upvoted comments

Getting the same error with angular-cli 8.3.0 trying to set up angular universal.

First step in the guide says to run:

ng add @nguniversal/express-engine --clientProject <angular-project>

Doing that seems to install @nguniversal/express-engine properly, but then I get:

Cannot read property 'kind' of undefined

@harshsyno The problem is, this still happens when I tried adding my old components/modules to a completely new project using the latest angular-cli 😐

Still having this issue. It’s so annoying

Let us know (in a new issue) if you hit this issue again and you notice a pattern for reproduction.

What’s the reason to close this issue. It seems to me this is not resolved at all.

@myWorkingGithub, @izzeda, @shripadgodse, @dsldiesel Kindly Stop compiler with cntr+c & Recompile entire project. This will end the error.

Please solution! This error appears randomly when updating a ts file that imports swal!!!

I am getting this issue as well despite updates and making sure that local/global cli are same version

@jer-tx , I had the same problem.

What helped to me was to delete both “node_modules” and “package-lock.json”. Then I run the command ng add @nguniversal/express-engine --clientProject <angular-project> and it complained about missing node modules. I installed them manually one by one (only what was really necessary) . And finally it worked! After that you can re-install everything else by npm run i

Simply stop application and execute “npm install” again. It fixed my issue.

Ok. I’ll migrate my project to a new one - wanted to re-work the design anyway. If I notice something I’ll report here.

The error is just annoying. As @djleonskennedy said recompiling fixes it

We’d need a bit more to look into this for example a code snippet that is causing this error.

If you instrument the checkSourceFile function in typescript.js to print node.path on entry, you can at least check what file started the chain of operations that led to the crash. Typescript don’t have any builtin functionality for tracking checker crashes.