title: Angular2 Component is not defined
body: <p>I am building up an Angular2 app, but my files aren't compiled correctly.</p>
  
  <p>Found some similar issues, but no solution worked to me.</p>
  
  <p>I am getting Error in console:</p>
  
  <pre><code>(index):19 Error: (SystemJS) ReleasesComponent is not defined
  ReferenceError: ReleasesComponent is not defined
      at eval (http://localhost:3000/app/app.component.js:21:26)
      at Object.eval (http://localhost:3000/app/app.component.js:27:2)
      at eval (http://localhost:3000/app/app.component.js:30:4)
      at eval (http://localhost:3000/app/app.component.js:31:3)
      at eval (&lt;anonymous&gt;)
      at Object.eval (http://localhost:3000/app/app.module.js:15:23)
      at eval (http://localhost:3000/app/app.module.js:48:4)
      at eval (http://localhost:3000/app/app.module.js:49:3)
      at eval (&lt;anonymous&gt;)
  Evaluating http://localhost:3000/app/app.component.js
  Evaluating http://localhost:3000/app/app.module.js
  Evaluating http://localhost:3000/app/main.js
  Error loading http://localhost:3000/app/main.js
      at eval (http://localhost:3000/app/app.component.js:21:26)
      at Object.eval (http://localhost:3000/app/app.component.js:27:2)
      at eval (http://localhost:3000/app/app.component.js:30:4)
      at eval (http://localhost:3000/app/app.component.js:31:3)
      at eval (&lt;anonymous&gt;)
      at Object.eval (http://localhost:3000/app/app.module.js:15:23)
      at eval (http://localhost:3000/app/app.module.js:48:4)
      at eval (http://localhost:3000/app/app.module.js:49:3)
      at eval (&lt;anonymous&gt;)
  Evaluating http://localhost:3000/app/app.component.js
  Evaluating http://localhost:3000/app/app.module.js
  Evaluating http://localhost:3000/app/main.js
  Error loading http://localhost:3000/app/main.js
  </code></pre>
  
  <p><strong>app.module.ts</strong></p>
  
  <pre><code>import { NgModule }      from '@angular/core';
  import { BrowserModule } from '@angular/platform-browser';
  import { FormsModule } from '@angular/forms';
  import { HttpModule, JsonpModule } from '@angular/http';
  
  import { AppComponent }  from './app.component';
  import { HomeComponent } from './home/home.component';
  import { ReleasesComponent } from './releases/releases.component';
  import { DistroComponent } from './distro/distro.component';
  import { ContactsComponent } from './contacts/contacts.component';
  import { routing } from './app.routes';
  
  
  @NgModule({
    imports:      [ 
      BrowserModule,
      FormsModule,
      HttpModule,
      JsonpModule,
      routing
    ],
  
    declarations: [ 
      AppComponent,
      HomeComponent,
      ReleasesComponent,
    DistroComponent,
      ContactsComponent
    ],
  
     bootstrap: [ AppComponent ]
   }) 
  export class AppModule { }
  </code></pre>
  
  <p><strong>releases.component.ts</strong></p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  
  @Component({
    selector: 'releases',
    templateUrl: 'app/releases/releases.component.html',
    providers: [ReleasesService]
  })
  
  export class ReleasesComponent implements OnInit {
   releases: Observable&lt;Array&lt;string&gt;&gt;;
  
  constructor(private releasesService: ReleasesService) { 
  }
  
  ngOnInit() { 
    this.releases = this.releasesService.getReleases();
   }
  }
  </code></pre>
  
  <p><strong>tsconfig.json</strong></p>
  
  <pre><code>{
  "compilerOptions": {
  "target": "es5",
  "module": "commonjs",
  "moduleResolution": "node",
  "sourceMap": true,
  "emitDecoratorMetadata": true,
  "experimentalDecorators": true,
  "lib": [ "es2015", "dom" ],
  "noImplicitAny": true,
  "suppressImplicitAnyIndexErrors": true
   }
  }
  </code></pre>
  
  <p><strong>index.html</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;base href="/"&gt;
  &lt;title&gt;PR PR PR&lt;/title&gt;
  &lt;meta charset="UTF-8"&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
  &lt;link rel="stylesheet" href="app/assets/flex.css"&gt;
  &lt;link rel="stylesheet" href="app/assets/styles.css"&gt;
  
  &lt;!-- Polyfill(s) for older browsers --&gt;
  &lt;script src="node_modules/core-js/client/shim.min.js"&gt;&lt;/script&gt;
  
  &lt;script src="node_modules/zone.js/dist/zone.js"&gt;&lt;/script&gt;
  &lt;script src="node_modules/systemjs/dist/system.src.js"&gt;&lt;/script&gt;
  
  &lt;script src="systemjs.config.js"&gt;&lt;/script&gt;
  &lt;script&gt;
    System.import('app').catch(function(err){ console.error(err); });
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;my-app&gt;Loading AppComponent content here ...&lt;/my-app&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>app.component.ts</strong></p>
  
  <pre><code>import { Component } from '@angular/core';
  import { Http } from '@angular/http';
  import { ReleasesComponent } from './releases/releases.component';
  import { ReleasesService } from './releases/releases.service';
  
  @Component({
    selector: 'my-app',
    templateUrl: './app.component.html',
    directives: [ReleasesComponent],
    providers: [Http, ReleasesService]
  })
  export class AppComponent  { name = 'My name'; }
  </code></pre>
  
  <p><strong>Folders structure</strong>
  <a href="https://i.stack.imgur.com/smRqP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/smRqP.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/sKoOZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sKoOZ.png" alt="enter image description here"></a></p>