Skip to content

Cannot read property 'kind' of undefined during version 9 update #16022

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

Closed
filipesilva opened this issue Nov 1, 2019 · 8 comments
Closed

Cannot read property 'kind' of undefined during version 9 update #16022

filipesilva opened this issue Nov 1, 2019 · 8 comments
Assignees
Labels
area: @angular/cli freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix
Milestone

Comments

@filipesilva
Copy link
Contributor

This issue impacts 9.0.0-rc.0 and happened while updating https://github.com/vmware/clarity.

The following migration failed while running, interrupting the update process.

>  Undecorated classes with DI migration.
   As of Angular 9, it is no longer supported to use Angular DI on a class that does not have an Angular decorator.
   Read more about this here: https://v9.angular.io/guide/migration-undecorated-classes

    This migration uses the Angular compiler internally and therefore projects that no longer build successfully after the update cannot run the migration. Please ensure there are no AOT compilation errors and rerun the migration.. The following project failed: src/clr-angular/tsconfig.prod.json

    Error: error TS100: Cannot determine the module for class ButtonViewTestComponent in D:/sandbox/clarity/src/clr-angular/button/button-group/button.spec.ts! Add ButtonViewTestComponent to the NgModule to fix it.
    Cannot determine the module for class TestIndex in D:/sandbox/clarity/src/clr-angular/emphasis/alert/alerts-pager.spec.ts! Add TestIndex to the NgModule to fix it.
    Cannot determine the module for class TestInstance in D:/sandbox/clarity/src/clr-angular/emphasis/alert/alerts-pager.spec.ts! Add TestInstance to the NgModule to fix it.
    Cannot determine the module for class BasicWizardTestComponent in D:/sandbox/clarity/src/clr-angular/wizard/test-components/basic-wizard.mock.ts! Add BasicWizardTestComponent to the NgModule to fix it.
    Cannot determine the module for class HeaderActionsTestComponent in D:/sandbox/clarity/src/clr-angular/wizard/test-components/header-action-wizard.mock.ts! Add HeaderActionsTestComponent to the NgModule to fix it.
    Cannot determine the module for class TemplateApiWizardTestComponent in D:/sandbox/clarity/src/clr-angular/wizard/test-components/api-wizard.mock.ts! Add TemplateApiWizardTestComponent to the NgModule to fix it.
    Cannot determine the module for class DynamicWizardTestComponent in D:/sandbox/clarity/src/clr-angular/wizard/test-components/dynamic-wizard.mock.ts! Add DynamicWizardTestComponent to the NgModule to fix it.
    Cannot determine the module for class UnopenedWizardTestComponent in D:/sandbox/clarity/src/clr-angular/wizard/test-components/unopened-wizard.mock.ts! Add UnopenedWizardTestComponent to the NgModule to fix it.


Cannot read property 'kind' of undefined
git HEAD was at ef1733759ceeff88ceb7ab7ff01f5da604fb79cb before migrations.
×  Migration failed. See above for further details.
@filipesilva filipesilva added type: bug/fix freq1: low Only reported by a handful of users who observe it rarely severity3: broken area: @angular/cli labels Nov 1, 2019
@filipesilva filipesilva added this to the 9.0.x milestone Nov 1, 2019
@devversion
Copy link
Member

devversion commented Nov 2, 2019

The kind of undefined error surfaces due to #16035. All of the migrations make the assumption that the tsconfig files are valid. This is no longer the case due to the CLI migration failure.

I'll fix this in the framework migrations, as apparently it cannot assume that the tsconfig is always valid.

@devversion devversion self-assigned this Nov 2, 2019
@filipesilva
Copy link
Contributor Author

@devversion also mentioned that this can happen when test files are included, which happens in library project because the tsconfigs used by ng-packagr automatically filter out spec files. Maybe we should update these configs to exclude the test files.

@elvisbegovic
Copy link
Contributor

elvisbegovic commented Nov 4, 2019

Could this be related angular/angular#33143 got this error 20 days ago

(nit: after moving from single-app to monorepo ( multi projects/ in workspace) I don't have this error anymore)

@devversion
Copy link
Member

I'm not sure if that is related. This issue seems to be because of #16035 where program.getSourceFile() returns undefined. The other issue you linked to seems to originate from the AngularCompilerProgram. I'd love to investigate this, but I'm not sure how I can reproduce this.

@vikerman
Copy link
Contributor

vikerman commented Nov 7, 2019

Assigning to Filipe for verification

@vikerman vikerman modified the milestones: v9-candidates, v9-blockers Nov 7, 2019
@devversion
Copy link
Member

For reference: The error is no longer thrown as part of the migration and we now gracefully report if the tsconfig of a migration target has failures. I think the CLI migration that generates these invalid tsonfigs has been fixed, so I think that can be closed.

@filipesilva
Copy link
Contributor Author

I can confirm Cannot read property 'kind' of undefined is no longer shown on that update.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: @angular/cli freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix
Projects
None yet
Development

No branches or pull requests

4 participants