question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular 9 build failed

See original GitHub issue

Bug Report

What is the expected behavior?

$ ng update
$ ng build
[2] 
[2] Compiling @angular/material/button : es2015 as esm2015
[2] 
[2] Compiling @angular/cdk/layout : es2015 as esm2015
[2] 
[2] Compiling @angular/material/snack-bar : es2015 as esm2015
[2] 
[2] Compiling @angular/material/dialog : es2015 as esm2015
[2] 
[2] Compiling @angular/flex-layout/core : es2015 as esm2015
[2] 
[2] Compiling @angular/flex-layout/extended : es2015 as esm2015
[2] 
[2] Compiling @angular/flex-layout/flex : es2015 as esm2015
[2] 
[2] Compiling @angular/flex-layout/grid : es2015 as esm2015
[2] 

[2] ERROR in Failed to compile entry-point @angular/flex-layout (es2015 as esm2015) due to compilation errors:
[2] ../../../../cloud-user/ui-packages/node_modules/@angular/flex-layout/flex/typings/module.d.ts:6:22 - error NG6002: Appears in the NgModule.imports of FlexLayoutModule, but could not be resolved to an NgModule class
[2] 
[2] 6 export declare class FlexModule {
[2]                        ~~~~~~~~~~
[2] ../../../../cloud-user/ui-packages/node_modules/@angular/flex-layout/extended/typings/module.d.ts:6:22 - error NG6002: Appears in the NgModule.imports of FlexLayoutModule, but could not be resolved to an NgModule class
[2] 
[2] 6 export declare class ExtendedModule {
[2]                        ~~~~~~~~~~~~~~
[2] ../../../../cloud-user/ui-packages/node_modules/@angular/flex-layout/grid/typings/module.d.ts:6:22 - error NG6002: Appears in the NgModule.imports of FlexLayoutModule, but could not be resolved to an NgModule class
[2] 
[2] 6 export declare class GridModule {
[2]                        ~~~~~~~~~~
[2] ../../../../cloud-user/ui-packages/node_modules/@angular/flex-layout/flex/typings/module.d.ts:6:22 - error NG6003: Appears in the NgModule.exports of FlexLayoutModule, but could not be resolved to an NgModule, Component, Directive, or Pipe class
[2] 
[2] 6 export declare class FlexModule {
[2]                        ~~~~~~~~~~
[2] ../../../../cloud-user/ui-packages/node_modules/@angular/flex-layout/extended/typings/module.d.ts:6:22 - error NG6003: Appears in the NgModule.exports of FlexLayoutModule, but could not be resolved to an NgModule, Component, Directive, or Pipe class
[2] 
[2] 6 export declare class ExtendedModule {
[2]                        ~~~~~~~~~~~~~~
[2] ../../../../cloud-user/ui-packages/node_modules/@angular/flex-layout/grid/typings/module.d.ts:6:22 - error NG6003: Appears in the NgModule.exports of FlexLayoutModule, but could not be resolved to an NgModule, Component, Directive, or Pipe class
[2] 
[2] 6 export declare class GridModule {
[2]                        ~~~~~~~~~~
[2] 
[2] error Command failed with exit code 1.
[2] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[2] yarn build.test exited with code 1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
srilekcommented, Mar 27, 2020

Hi , I also faced the similar issue but I updated the flex-layout component (npm install @angular/flex-layout@latest --save) and served it again ,it worked for me . My angular version and flex-layout version is as below “@angular/animations”: “^9.0.7”, “@angular/cdk”: “^9.2.0”, “@angular/common”: “~9.0.3”, “@angular/compiler”: “~9.0.3”, “@angular/core”: “~9.0.3”, “@angular/flex-layout”: “^9.0.0-beta.29”,

2reactions
adamdportcommented, Mar 3, 2020

@CaerusKaru I

  • deleted node modules in my project, in my library, and in my library’s project folder
  • deleted the output (/dist) folder in my project and in my library
  • cleared my npm cache
  • updated npm modules in my project and library (now on 9.0.4)

It looks like Angular changed the error message slightly but it’s just a more verbose version of the same thing:

ERROR in Failed to compile entry-point @angular/flex-layout (es2015 as esm2015) due to compilation errors:
../../../common-angular-workspace/node_modules/@angular/flex-layout/flex/typings/module.d.ts:6:22 - error NG6002: Appears in the NgModule.imports of FlexLayoutModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/flex-layout/flex) which declares FlexModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

6 export declare class FlexModule {
                       ~~~~~~~~~~
../../../common-angular-workspace/node_modules/@angular/flex-layout/extended/typings/module.d.ts:6:22 - error NG6002: Appears in the NgModule.imports of FlexLayoutModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/flex-layout/extended) which declares ExtendedModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a
newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

6 export declare class ExtendedModule {
                       ~~~~~~~~~~~~~~
../../../common-angular-workspace/node_modules/@angular/flex-layout/grid/typings/module.d.ts:6:22 - error NG6002: Appears in the NgModule.imports of FlexLayoutModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/flex-layout/grid) which declares GridModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

6 export declare class GridModule {
                       ~~~~~~~~~~
../../../common-angular-workspace/node_modules/@angular/flex-layout/flex/typings/module.d.ts:6:22 - error NG6003: Appears in the NgModule.exports of FlexLayoutModule, but could not be resolved to an NgModule, Component, Directive, or Pipe class.

This likely means that the library (@angular/flex-layout/flex) which declares FlexModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

6 export declare class FlexModule {
                       ~~~~~~~~~~
../../../common-angular-workspace/node_modules/@angular/flex-layout/extended/typings/module.d.ts:6:22 - error NG6003: Appears in the NgModule.exports of FlexLayoutModule, but could not be resolved to an NgModule, Component, Directive, or Pipe class.

This likely means that the library (@angular/flex-layout/extended) which declares ExtendedModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a
newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

6 export declare class ExtendedModule {
                       ~~~~~~~~~~~~~~
../../../common-angular-workspace/node_modules/@angular/flex-layout/grid/typings/module.d.ts:6:22 - error NG6003: Appears in the NgModule.exports of FlexLayoutModule, but could not be resolved to an NgModule, Component, Directive, or Pipe class.

Flex layout is a peer dependency in my library along with all the other common angular dependencies. I can try putting together a reproduction repo if that would be helpful?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 9 application build fails when working with linked ...
Make changes in the library. After library build succeeds, copy dist/my-lib and paste it in the application's node_modules folder(this triggers ...
Read more >
Identify and Fix Build and Deployment Errors in Your Angular ...
In this guide, you will learn how to spot some of the most common build and deployment errors and how to resolve them...
Read more >
Build failure - angular-bootstrap-md index.ts is not part of
ERROR in ./node_modules/angular-bootstrap-md/index.ts Module build failed: Error: C:projectsangular-examplenode_modulesangular-bootstrap-mdindex.ts is not ...
Read more >
error: failed to initialize angular compilation - ngcc failed.
As misha130 suggested in the comments, there was (a single) library not aligned with the latest Ivy changes which was causing the error....
Read more >
ng build - Angular
Option Description Value Type Default Value ‑‑aot Build using Ahead of Time compilation. boolean true ‑‑base‑href Base url for the application being built. string ‑‑delete‑output‑path Delete...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found