Software⏱️ 3 min read📅 2026-06-03

How to Fix: error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class

Learn how to fix: error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

Quick Answer: Try checking your system settings or restarting.

Error NG6002 appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class. This error is typically encountered when working with Ivy in Angular applications.

This error specifically affects developers who are new to Firestore and have recently updated from Angular Fire 5 to 6, as suggested by other answers.

🛑 Root Causes of the Error

  • The primary cause of this error is the mismatch between the Angular version used in the project and the version required by the Angular Fire package.
  • Another possible reason for this error is the incorrect configuration of the tsconfig.app.json file, particularly when working with Ivy.

✅ Best Solutions to Fix It

Updating the Angular version to match the requirements of the Angular Fire package

  1. Step 1: Open the tsconfig.app.json file and update the target property to 'es2015' or 'es2020', depending on the version of Angular Fire being used.
  2. Step 2: Update the lib property to include the required libraries for the chosen Angular version.
  3. Step 3: Save the changes and try compiling the application again.

Configuring Ivy in tsconfig.app.json

  1. Step 1: Open the tsconfig.app.json file and update the experimentalImports property to 'true'.
  2. Step 2: Update the moduleResolution property to 'node' or 'classic', depending on the desired behavior.
  3. Step 3: Save the changes and try compiling the application again.

🎯 Final Words

By following these steps, you should be able to resolve the Error NG6002 and get your Angular application up and running with Firestore. Remember to carefully review the documentation for both Angular Fire and Ivy to ensure a smooth transition.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions