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.

Error NG6002: Upgraded LIB to NG9

See original GitHub issue

🐞 bug report

Affected Package

There is a similar problem https://github.com/angular/angular/issues/35536 and if I follow instructions from this issue it works as a workaround

Is this a regression?

Yes. NG8 has no problem compiling local libs and local app to test it.

Description

As you can see it here at MetaUI, I have libs and apps folders.

Libs contains two libraries ( that we shoudl care about now):

  • rules - core rules engine library
  • material-rules - Specific UI library implementation for rules. It also uses and imports core rules library

Then I have apps as playground:

  • material-app: which imports both libraries.

The normal workflow in NG8 to be able to test material-app was:

ng build rules 
ng build material-rules
ng build material-app
ng serve material-app

Now ng build material-app fails with NG6002 & NG6003 errors.

But if I follow #35536, and run npx ngcc && ngcc -s dist before building material-app, all works. so Running:

rm -Rf dist && ng build rules && ng build material-rules && npx ngcc && ngcc -s dist
ng build material-app

fixes problem

🔬 Minimal Reproduction

git clone -b ng9 https://github.com/ngx-meta/rules.git
cd rules/
npm install

// Now you can run to see errors
rm -Rf dist && ng build rules && ng build material-rules && ng build material-app

// run to fix it
rm -Rf dist && ng build rules && ng build material-rules && npx ngcc && ngcc -s dist
ng build material-app

🔥 Exception or Error



ERROR in dist/libs/rules/lib/metaui/rules.module.d.ts:27:22 - error NG6002: Appears in the NgModule.imports of MetaUILibLayoutModule, but could not be resolved to an NgModule class.

This likely means that the dependency (@ngx-metaui/rules) which declares MetaUIRulesModule has not been processed correctly by ngcc.

27 export declare class MetaUIRulesModule {
                        ~~~~~~~~~~~~~~~~~
libs/material-rules/src/lib/metaui/meta-ui-layout.module.ts:71:14 - error NG6002: Appears in the NgModule.imports of MaterialRulesModule, but itself has errors

71 export class MetaUILibLayoutModule {
                ~~~~~~~~~~~~~~~~~~~~~
dist/libs/rules/lib/metaui/rules.module.d.ts:27:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the dependency (@ngx-metaui/rules) which declares MetaUIRulesModule has not been processed correctly by ngcc.

27 export declare class MetaUIRulesModule {
                        ~~~~~~~~~~~~~~~~~
libs/material-rules/src/lib/material-rules.module.ts:40:14 - error NG6002: Appears in the NgModule.imports of AppModule, but itself has errors

40 export class MaterialRulesModule {

🌍 Your Environment

Angular Version:


Angular CLI: 9.0.6
Node: 12.0.0
OS: darwin x64

Angular: 9.0.7
... 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.6
@angular-devkit/build-angular      0.900.6
@angular-devkit/build-ng-packagr   0.900.6
@angular-devkit/build-optimizer    0.900.6
@angular-devkit/build-webpack      0.900.6
@angular-devkit/core               9.0.7
@angular-devkit/schematics         9.0.7
@angular/cdk                       9.1.2
@angular/cli                       9.0.6
@angular/material                  9.1.2
@ngtools/webpack                   9.0.6
@schematics/angular                9.0.6
@schematics/update                 0.900.6
ng-packagr                         9.0.3
rxjs                               6.5.4
typescript                         3.7.5
webpack                            4.41.2

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
petebacondarwincommented, Mar 29, 2020

I can confirm that locally #36305 also fixes your problem @boskiv .

1reaction
boskivcommented, Mar 27, 2020

So guys, I’m not quite sure what I have to do to get it working in my case? 😃 https://github.com/NG-ZORRO/ng-zorro-antd/issues/4917 Can you advise?

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 ...
Read more >
value at position 1 in the ngmodule.declarations of appmodule ...
When I created a new repository using: ng new test-ng9 and then added angular ... Title line template: error NG6002: Appears in the...
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 >
Ivy Error - The Ngcc Compiler Has Changed Since The Last ...
After upgrading to Angular 10, ivy ngcc is compiling as a esm5, umd modules. Help Request. My Environnement: ngular CLI: 10.2.0 Node: 12.15.0...
Read more >
The library (@angular/forms) which declares FormBuilder has ...
Check if a newer version of the library is available, and update if so. ... node_modules/@angular/forms/forms.d.ts:2148:22 - error NG6002: ...
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