Error: XHR error (404 Not Found) in Angular2 application

Error: XHR error (404 Not Found) in Angular2 application

我是 angularjs 的新手,使用 angular2 开发了一个演示应用程序。 运行 应用程序时出现以下错误。虽然下面的错误显示 404,但当我在扩展名为 .js 的浏览器上点击相同的 url(即 http://localhost:4679/Binder/CustomerModuleLibrary)时,脚本确实会加载到浏览器中。

Here is the error:

Error: Error: XHR error (404 Not Found) loading http://localhost:4679/Binder/CustomerModuleLibrary
        at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://localhost:4679/node_modules/zone.js/dist/zone.js:698:29)
        at ZoneDelegate.invokeTask (http://localhost:4679/node_modules/zone.js/dist/zone.js:265:35)
        at Zone.runTask (http://localhost:4679/node_modules/zone.js/dist/zone.js:154:47)
        at XMLHttpRequest.ZoneTask.invoke (http://localhost:4679/node_modules/zone.js/dist/zone.js:335:33)
    Error loading http://localhost:4679/Binder/CustomerModuleLibrary as "./CustomerModuleLibrary" from http://localhost:4679/UI/startup/../../Binder/Startup.js

CustomerModuleLibrary.ts

的代码
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {CustomerComponent} from './CustomerComponent';
import {FormsModule} from '@angular/forms'

@NgModule({
    imports: [BrowserModule,FormsModule],
    declarations: [CustomerComponent],
    bootstrap: [CustomerComponent]
})
export class CustomerModuleLibrary { }

Startup.ts

的代码
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {CustomerModuleLibrary} from './CustomerModuleLibrary';
const platform = platformBrowserDynamic();
platform.bootstrapModule(CustomerModuleLibrary);

在systemjs.config.js文件中,

packages: {
app: {
    main: '../../Binder/Startup.js',
defaultExtension: 'js'
}, 
rxjs: {
defaultExtension: 'js'
},

此外,我应该在 运行 应用程序之前执行 npm start 吗?

我错过了在 master.html 中添加这个。添加这个解决了这个问题。

System.config({
       "defaultJSExtensions":true
    });