Angular: NG6008: Component X is standalone, and cannot be declared in an NgModule. Did you mean to import it instead?
A standalone component, directive or pipe was listed in an NgModule's declarations array.
NG6008: Component is standalone, and cannot be declared in an NgModuleis standalone, and cannot be declared in an NgModule. Did you mean to import it instead?cannot be declared in an NgModuleNG6008: Component X is standalone Meaning
Standalone declarables (standalone: true, default since Angular 19) are never declared in modules. Put them in imports instead. After migrating to standalone (or upgrading to v19) leftover declarations entries cause NG6008; the opposite problem (a non-standalone component in imports) gives NG6000-series messages.
Common causes
- Component generated with
standalone: true(or Angular 19 default) but added todeclarations - Migration to standalone left old module entries
- Copy-pasted module from an older project
- Library component that is standalone declared in a module
- Mixed old/new schematics output
⚡ Quick fix
- Move the standalone component from
declarationstoimports - Or remove
standalone: trueand keep it declared (v18 and older) - Run the standalone migration schematic
Detailed fix by platform
Angular CLI
ng generate @angular/core:standalonemigrates modules step by step
Angular
- NgModule:
@NgModule({ imports: [UserCardComponent] })(notdeclarations)
Code examples
Import, don't declare
@NgModule({
declarations: [], // standalone components do not belong here
imports: [CommonModule, UserCardComponent],
})
export class UsersModule {}How to diagnose
- Flag — Is the component standalone?
- Module — Where is it listed?
- Version — Angular 19+ (standalone default)?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- exceeded maximum budget Angular build: Error: bundle initial exceeded maximum budget. Budget 1.00 MB was not met by 120.00 kB with a total of 1.12 MB
- NG0300 Angular: NG0300: Multiple components match node with tagname app-x: A and B
- NG0912 Angular: NG0912: Component ID generation collision detected. Components 'A' and 'B' with selector 'app-x' use the same ID
Most viewed in Angular
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 15 Oct 2026