Accepted answer

may be many reasons why you get this error message. I got it when I accidentally added a shared module to the module declarations list and not to imports.

In app.module.ts:

import { SharedModule } from './modules/shared/shared.module';

@NgModule({
  declarations: [
     // Should not have been added here...
  ],
  imports: [
     SharedModule
  ],

 same issue when using ngc. It seems to work fine without it
Unexpected value 'HelloWorld in C:/git/Repo/src/WebApp/node_modules/hello-world-component/lib/hello-world.component.d.ts' declared by the module 'AppModule in C:/git/Repo/src/WebApp/scripts/app/app.module.ts'. Please add a @Pipe/@Directive/@Component annotation.


You have probably missed to export FlashMessageComponent from FlashMessageModule

@NgModule({})
export declare class FlashMessageModule {
     declarations: [ FlashMessageComponent],
     exports: [ FlashMessageComponent]
}



It should be just
@NgModule({})
export class FlashMessageModule {
}

remove declare from the above. a

Also remove FlashMessageModule from declarations, you should have only components inside it.


 I had a custom module being Declared in the AppModule. This was unnecessary as the app-routing was handling the custom modules. Just remove the declaration and it worked. hope this helps someone

your LoginComponent's file

import { Component } from '@angular/Core';

It's lowercase c, not uppercase

import { Component } from '@angular/core';

 faced the same error when I used another class instead of component down the component decorator.

Component class must come just after the component decorator

  @Component({
 selector: 'app-smsgtrecon',
 templateUrl: './smsgtrecon.component.html',
 styleUrls: ['./smsgtrecon.component.css'],
 providers: [ChecklistDatabase]
 })


// THIS CAUSE ISSUE MOVE THIS UP TO COMPONENT DECORATOR
/**
* Node for to-do item
*/
 export class TodoItemNode {
 children: TodoItemNode[];
 item: string;
}


 export class SmsgtreconComponent implements OnInit {

After moving TodoItemNode to the top of component decorator it worked

Solution

// THIS CAUSE ISSUE MOVE THIS UP TO COMPONENT DECORATOR
/**
* Node for to-do item
*/
 export class TodoItemNode {
 children: TodoItemNode[];
 item: string;
}


@Component({
 selector: 'app-smsgtrecon',
 templateUrl: './smsgtrecon.component.html',
 styleUrls: ['./smsgtrecon.component.css'],
 providers: [ChecklistDatabase]
 })


 export class SmsgtreconComponent implements OnInit {