Angular 2: Module not found: Error: Can't resolve

If your component is inside the same directory, then you need to point your templateUrl to the same folder as well. Here is how you can do it:

@Component({
    selector: 'app-sb',
    templateUrl: './sb.component.html'
})

This problem is very well known, when we are using component relative paths for external html and css files. The problem of absolute path and relative path can be resolved just by adding metadata ModuleId in component.

Now what does ModuleId do? ModuleId contains the absolute URL of the component class [when the module file is actually loaded]

This ModuleId value is used by the Angular reflection processes and the metadata_resolver component to evaluate the fully-qualified component path before the component is constructed

It's very easy to use. Just add one more entry in @Component decorative. Full code example is below.

 @Component({
  moduleId: module.id,    // fully resolved filename; defined at module load time
  selector: 'app-sb',
  templateUrl: 'sb.component.html' //Observe this.
})
export class SBComponent  {

}

My problem was the same as questioned here, my solution was quite different

code that was causing problem:

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

here by changing :

styleUrls : ['']

to this:

styles : ['']

helped me remove module not found error, thought someone might get this error due to this silly mistake, that's why shared my solution