Skip to content

Uncaught exception using ivy #31314

Closed
Closed

Description

@fr0

🐞 bug report

Affected Package

Unknown.

Is this a regression?

Only happen when using Ivy.

Description

An unhandled exception occurs immediately, and my app does not load.

🔥 Exception or Error


core.js:30223 Uncaught TypeError: Cannot read property 'id' of undefined
    at registerNgModuleType (core.js:30223)
    at core.js:30241
    at Array.forEach ()
    at registerNgModuleType (core.js:30237)
    at new NgModuleFactory$1 (core.js:30375)
    at compileNgModuleFactory__POST_R3__ (core.js:34663)
    at PlatformRef.bootstrapModule (core.js:34960)
    at Module../src/main.ts (main.ts:11)
    at __webpack_require__ (bootstrap:79)
    at Object.0 (main.ts:11)

🌍 Your Environment

Angular Version:




Angular CLI: 8.1.0-beta.3
Node: 12.4.0
OS: darwin x64
Angular: 8.1.0-rc.0
... animations, common, compiler, compiler-cli, core, elements
... forms, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.801.0-beta.3
@angular-devkit/build-angular     0.801.0-beta.3
@angular-devkit/build-optimizer   0.801.0-beta.3
@angular-devkit/build-webpack     0.801.0-beta.3
@angular-devkit/core              8.1.0-beta.3
@angular-devkit/schematics        8.1.0-beta.3
@angular/cli                      8.1.0-beta.3
@ngtools/json-schema              1.1.0
@ngtools/webpack                  8.1.0-beta.3
@schematics/angular               8.1.0-beta.3
@schematics/update                0.801.0-beta.3
ng-packagr                        5.3.0
rxjs                              6.5.2
typescript                        3.4.5
webpack                           4.35.0

Activity

  1. added
    area: compilerIssues related to `ngc`, Angular's template compiler
    needs reproductionThis issue needs a reproduction in order for the team to investigate further
    on Jun 27, 2019
  2. added this to the needsTriage milestone on Jun 27, 2019
  3. AndrewKushnir commented on Jun 27, 2019

    @AndrewKushnir
    Contributor

    @fr0, could you please provide some additional information on how to reproduce this issue? It'd be helpful if you could create a repro using https://stackblitz.com/, so we can investigate the problem. Thank you.

  4. bennadel commented on Jun 28, 2019

    @bennadel

    I get the same error when I try to import the Animations module. I don't even attempt to use it -- this is just from the import:

    import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
    import { BrowserModule } from "@angular/platform-browser";
    import { NgModule } from "@angular/core";
    
    @NgModule({
    	imports: [
    		BrowserModule,
    		BrowserAnimationsModule
    	],
    	....

    2019-06-28_06-41-32

    I am currently using "next", which installs 8.1.0-rc.0. I also have Ivy enabled. I can't figure out how to enable Ivy in StackBlitz. There doesn't seem to be a tsconfig file.

  5. fr0 commented on Jun 28, 2019

    @fr0
    Author

    Removing BrowserAnimationsModule does "fix" the problem for me as well.

  6. fr0 commented on Jun 28, 2019

    @fr0
    Author

    While trying to create a reproducible repo, I added back the BrowserAnimationsModule and now I'm getting a different (compile-time) error:

    ERROR in ../node_modules/@angular/platform-browser/animations/animations.d.ts:37:22 - error TS-996002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class
    
    37 export declare class BrowserAnimationsModule {
                            ~~~~~~~~~~~~~~~~~~~~~~~
    

    I have no idea what I did wrong. I'll poke more at this Monday.

  7. AndrewKushnir commented on Jun 29, 2019

    @AndrewKushnir
    Contributor

    Thanks for additional information.

    It looks like this issue is similar to the one described in #31348 and there is a fix that should resolve the issue: angular/angular-cli#14934, see comment from @alexzuza. The fix will most likely be included into the next CLI release.

  8. removed
    needs reproductionThis issue needs a reproduction in order for the team to investigate further
    on Jun 29, 2019
  9. alxhub commented on Jul 2, 2019

    @alxhub
    Member

    Fixed by the commit mentioned above.

  10. lwensveen commented on Jul 10, 2019

    @lwensveen

    Still get this issue with 8.2.0-next.0

    Example:
    node_modules/@angular/common/common.d.ts(115,22): error TS-996002: Appears in the NgModule.imports of CoreModule, but could not be resolved to an NgModule class~~

  11. hoangleitvn commented on Jul 11, 2019

    @hoangleitvn

    I faced this exception, then I have to turn off Ivy option to get detailed error

     "angularCompilerOptions": {
        "enableIvy": true
      }
    
  12. alexzuza commented on Jul 16, 2019

    @alexzuza
    Contributor

    @lwensveen Can you please provide a minimal reproducible example of your case?

  13. 14 remaining items

  14. Splaktar commented on Oct 15, 2019

    @Splaktar
    Contributor

    @gkalpak @alexzuza I hit this as well in a non-CLI project. Here's a branch with the repo: https://github.com/DevIntent/material2/tree/ivy-repro-31314.

    In the debugger, ngModuleType.ngModuleDef is clearly undefined for BrowserAnimationsModule but it is defined for MainModule.

    My guess atm is that we're using bootstrapModuleFactory which doesn't work in Ivy? I'm still looking into it...

  15. modified the milestones: needsTriage, Backlog on Oct 29, 2019
  16. Splaktar commented on Dec 6, 2019

    @Splaktar
    Contributor

    For the reproduction that I posted above, I believe that our solution to this was changing from

    ivy-ngcc --properties es2015 --create-ivy-entry-points

    to

    ivy-ngcc --properties main

    Please note that ivy-ngcc has since been renamed to ngcc.

  17. alxhub commented on Dec 6, 2019

    @alxhub
    Member

    Thanks @Splaktar! Closing as resolved.

  18. fclemonschool commented on Dec 12, 2019

    @fclemonschool

    angular version 9.0.0-rc.6 error still occurs.

    image

  19. Splaktar commented on Dec 12, 2019

    @Splaktar
    Contributor

    @fclemonschool please provide a reproduction via a GitHub repo. This can be caused be a misconfiguration of a project, so we need to see the full project to debug.

  20. Splaktar commented on Dec 16, 2019

    @Splaktar
    Contributor

    @vfe12345 Your repo link gives me a 404. Can you please open a new issue and reference this one?

  21. angular-automatic-lock-bot commented on Jan 16, 2020

    @angular-automatic-lock-bot

    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.

  22. locked and limited conversation to collaborators on Jan 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: compilerIssues related to `ngc`, Angular's template compilerfreq2: mediumneeds reproductionThis issue needs a reproduction in order for the team to investigate furthertype: bug/fix

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions