Angular error: Please add a @NgModule annotation

Move your Somecomponent to declaration part.

NgModule({
  imports: [
    CommonModule

  ],
  providers: [SomeService],
  declarations: [SomeComponent]

})
export class SomeModule {
}

You're trying to "import" a component in SomeModule.

imports: [
  CommonModule,
  SomeComponent
],

You import modules and declare components, which is exactly what the error message tells you -- you tried importing a directive SomeComponent.

Unexpected directive 'SomeComponent' imported by the module 'SomeModule'.

Move the SomeComponent from imports to declarations.

imports: [
  CommonModule,
],
providers: [SomeService],
declarations: [
  SomeComponent,
],

Tags:

Angular