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.

Appears in the NgModule.imports of <MyLibrary>, but could not be resolved to an NgModule class

See original GitHub issue

🐞 bug report

Affected Package

The issue is caused by package @angular/compiler 9.0.0-rc.11

Is this a regression?

Yes. In v8.2.14 it worked properly.

Description

at my app, I using library built by me with angular v8.0.3 and @angular/material v.8.1.2 and ng-packagr. then, error occured after update app to angular v9.0.0-rc.11.

ERROR in Failed to compile entry-point my-library (es2015 as esm2015) due to compilation errors:
vendor/my-library/dist/mylibrary-shared-feedback-dialog/node_modules/@angular/material/dialog/typings/dialog-module.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of MyLibrarySharedFeedbackDialogModule, but could not be resolved to an NgModule class

8 export declare class MatDialogModule {

A similar error occurs for the imported Angular Material Module.

🌍 Your Environment

Angular Version:




     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / β–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 9.0.0-rc.10
Node: 12.14.0
OS: linux x64

Angular: 9.0.0-rc.11
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.900.0-rc.10
@angular-devkit/build-angular      0.900.0-rc.10
@angular-devkit/build-optimizer    0.900.0-rc.10
@angular-devkit/build-webpack      0.900.0-rc.10
@angular-devkit/core               9.0.0-rc.10
@angular-devkit/schematics         9.0.0-rc.10
@angular/cdk                       9.0.0-rc.8
@angular/cli                       9.0.0-rc.10
@angular/flex-layout               8.0.0-beta.27
@angular/material                  9.0.0-rc.8
@angular/material-moment-adapter   9.0.0-rc.8
@ngtools/webpack                   9.0.0-rc.10
@schematics/angular                9.0.0-rc.10
@schematics/update                 0.900.0-rc.10
rxjs                               6.5.3
typescript                         3.7.5
webpack                            4.41.2

Issue Analytics

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

github_iconTop GitHub Comments

11reactions
VedantKarpecommented, Feb 15, 2020

Hi,

Created a new Angular 9 project and added angular material 9 from: using the command ng add @angular/material

I then followed the steps mentioned in the link to display a simple checkbox using Angular Material. The checkbox is displayed fine. However, the cli complains with the below error:

image

I then deleted the node_modules and did a npm install again. It seems to have fixed the issue.

Could you please try the following:

  1. Delete node_modules
  2. npm install

Repo: https://github.com/VedantKarpe/angular9

2reactions
ARTWINPROcommented, Feb 10, 2020

Guys, i have some solution but im not sure how currect it is.

1. "buildOptimizer": false,
2. "enableIvy": true
3. "aot": false,

Before do this refactoring, application size is: 18 440KB; After: 17 887KB

Read more comments on GitHub >

github_iconTop Results From Across the Web

Appears in the NgModule.imports of AppModule, but could not ...
It is likely you have installed something as root. It maybe time to check out the project again using the user account and...
Read more >
Answer: error NG6002: Appears in the NgModule.imports of ...
answer re: error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class ... Fixed it by...
Read more >
error NG6002 - Angular - CodeDocu.com
Angular Error NG6002 Appears the NgModule imports of AppModule but could not be resolved to class at node modules common http 81 22...
Read more >
'formgroup' does not appear to be an ngmodule class. - You.com
imports of AppModule, but could not be resolved to an NgModule class. This likely means that the library (@angular/common/http) which declares HttpClientModuleΒ ...
Read more >
error NG6002: Appears in the NgModule.imports of <module ...
This likely means that the library (ngx-print) which declares NgxPrintModule has not been processed correctly by ngcc, or is not compatible with Angular...
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