angular: ERROR in No NgModule metadata found for 'AppModule'

šŸž Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

No, Angular compile errrors have always been worthless. They ultimately create a toxic environment for the developer because hugh amounts of time are spent tracking them down, going into Angular Build internals, Searching Stack Overflow, Looking here, Looking there. Losing time when thereā€™s no time to loose.

Description

Iā€™m sure that all of these issues were caused by something I didā€¦ but why make it so difficult to fix things with poor build error messages?

Iā€™ve hit every one of these in past two weeks! Itā€™s stopped progress completely until each could be worked out.

This first one is what Iā€™m stuck on now, and the final straw. Itā€™s majorly defeating to us when we donā€™t have enough information to fix our own issues that only the compilers find but refuse to tell us anything.

None of these messages below are satisfactory, they tell us nothing!

ERROR in No NgModule metadata found for ā€˜AppModuleā€™

Cannot read property id of undefined

Cannot read property map of undefined

Accessor cannot be declared in an ambient context

Angular has no exported member

InjectionToken Function Calls are not supported

ERROR: Dependency @angular/animations must be explicitly whitelisted

An unhandled exception occurred: Configuration ā€˜productionā€™ is not set in the workspace

Error: self signed certificate in certificate chain - without reporting where or what to look for

Cannot find a differ supporting objectā€¦

šŸ”¬ Minimal Reproduction

I cannot minimally create a reproduction because:

  • I have no idea what the message means.
  • Iā€™m working on a large enterprise solution.

šŸ”„ Exception or Error


 ng build => ERROR in No NgModule metadata found for 'AppModule'

šŸŒ Your Environment

Enterprise App

Angular CLI: 8.3.25
Node: 12.18.0
OS: win32 x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.25
@angular-devkit/build-angular     0.803.26
@angular-devkit/build-optimizer   0.803.24
@angular-devkit/build-webpack     0.803.26
@angular-devkit/core              8.3.25
@angular-devkit/schematics        8.3.25
@angular/cdk                      8.2.3
@angular/cli                      8.3.25
@angular/material                 8.2.3
@ngtools/webpack                  8.3.25
@schematics/angular               8.3.25
@schematics/update                0.803.25
rxjs                              6.5.4
typescript                        3.5.3
webpack                           4.39.2

Our library version we are importing

{
  "name": "mslcc",
  "version": "0.0.1",
  "peerDependencies": {
    "@angular/common": "^9.0.7",
    "@angular/core": "^9.0.7"
  },
  "description": "This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.0.7.",
  "main": "bundles/mslcc.umd.js",
  "author": "John Peters, Brad Sheridan",
  "license": "ISC",
  "dependencies": {
    "@angular/common": "^9.0.7",
    "@angular/core": "^9.0.7",
    "@fortawesome/angular-fontawesome": "^0.6.1",
    "@fortawesome/fontawesome-svg-core": "^1.2.27",
    "@fortawesome/free-regular-svg-icons": "^5.13.1",
    "@fortawesome/free-solid-svg-icons": "^5.13.1",
    "rxjs": "^6.5.3",
    "tslib": "^1.10.0",
    "zone.js": "^0.10.3"
  },
  "module": "fesm5/mslcc.js",
  "es2015": "fesm2015/mslcc.js",
  "esm5": "esm5/mslcc.js",
  "esm2015": "esm2015/mslcc.js",
  "fesm5": "fesm5/mslcc.js",
  "fesm2015": "fesm2015/mslcc.js",
  "typings": "mslcc.d.ts",
  "metadata": "mslcc.metadata.json",
  "sideEffects": false
}

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (7 by maintainers)

Most upvoted comments

Transferred to the Angular repo for a better triage since these errors are thrown by the compiler.