angular: Uncaught exception using ivy

🐞 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 (<anonymous>)
    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

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 11
  • Comments: 29 (10 by maintainers)

Most upvoted comments

same error for my, any solution?

`Angular CLI: 8.3.6 Node: 10.16.3 OS: linux x64 Angular: 9.0.0-next.8 … animations, common, compiler, compiler-cli, core, forms … language-service, platform-browser, platform-browser-dynamic … router

Package Version

@angular-devkit/architect 0.803.6 @angular-devkit/build-angular 0.803.6 @angular-devkit/build-optimizer 0.803.6 @angular-devkit/build-webpack 0.803.6 @angular-devkit/core 8.3.6 @angular-devkit/schematics 8.3.6 @angular/cdk 8.2.2 @angular/cli 8.3.6 @angular/flex-layout 8.0.0-beta.27 @angular/material 8.2.2 @ngtools/webpack 8.3.6 @schematics/angular 8.3.6 @schematics/update 0.803.6 rxjs 6.5.3 typescript 3.5.3 webpack 4.39.2 `

package.json "dependencies": { "@angular/animations": "~9.0.0-next.8", "@angular/cdk": "^8.2.2", "@angular/common": "~9.0.0-next.8", "@angular/compiler": "~9.0.0-next.8", "@angular/core": "~9.0.0-next.8", "@angular/flex-layout": "^8.0.0-beta.27", "@angular/forms": "~9.0.0-next.8", "@angular/material": "^8.2.2", "@angular/platform-browser": "~9.0.0-next.8", "@angular/platform-browser-dynamic": "~9.0.0-next.8", "@angular/router": "~9.0.0-next.8", "hammerjs": "^2.0.8", "json-server": "^0.15.1", "module-alias": "^2.2.1", "moment": "^2.24.0", "ngx-file-drop": "^8.0.7", "rxjs": "~6.5.3", "stacktrace-js": "^2.0.1", "tslib": "^1.9.0", "zone.js": "~0.10.2" }

error: Uncaught TypeError: Cannot read property 'id' of undefined at registerNgModuleType (core.js:34738) at core.js:34756 at Array.forEach (<anonymous>) at registerNgModuleType (core.js:34752) at core.js:34756 at Array.forEach (<anonymous>) at registerNgModuleType (core.js:34752) at new NgModuleFactory$1 (core.js:34919) at compileNgModuleFactory__POST_R3__ (core.js:40668) at PlatformRef.bootstrapModule (core.js:41010)

Any solution ?

I still get this in error in 8.2.0-next.0 as well. And, what I realize is that it is not specific to the Animations module. I was also getting it when I tried to pull in the HTTPClient module as well. I wonder if it is any module other than the base browser one?

@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…

Getting the same issue. I noticed it showed up after I moved a component to a sub-folder.

Angular CLI: 8.0.6
Node: 11.10.0
OS: linux x64
Angular: 9.0.0-next.6

@angular-devkit/architect         0.803.4
@angular-devkit/build-angular     0.803.4
@angular-devkit/build-optimizer   0.803.4
@angular-devkit/build-webpack     0.803.4
@angular-devkit/core              8.3.4
@angular-devkit/schematics        8.0.6
@angular/cdk                      8.2.0
@angular/cli                      8.0.6
@angular/http                     6.1.10
@angular/material                 8.2.0
@ngtools/webpack                  8.3.4
@schematics/angular               8.0.6
@schematics/update                0.800.6
rxjs                              6.5.3
typescript                        3.5.3
webpack                           4.39.2

The error is

core.js:23008 Uncaught TypeError: Cannot read property 'id' of undefined
    at registerNgModuleType (core.js:23008)
    at core.js:23019
    at Array.forEach (<anonymous>)
    at registerNgModuleType (core.js:23019)
    at core.js:23019
    at Array.forEach (<anonymous>)
    at registerNgModuleType (core.js:23019)
    at new NgModuleFactory (core.js:23126)
    at compileNgModuleFactory__POST_R3__ (core.js:26594)
    at PlatformRef.push../node_modules/@angular/core/__ivy_ngcc__/fesm5/core.js.PlatformRef.bootstrapModule (core.js:26807)

Removing the browser module does not help. Is there workaround?

Thanks @Splaktar! Closing as resolved.

@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.