在我的Web服务器上,Angular运行时、样式和polyfiles出现了404错误。
在我的Web服务器上,Angular运行时、样式和polyfiles出现了404错误。
我制作了一个小的Angular应用程序,我在我的电脑上构建了它,但是当我尝试打开index.html文件时,出现404错误。我尝试将其部署到Web服务器上,但结果一样:
GET http://www.valhatech.com/runtime-es2015.edb2fcf2778e7bf1d426.js net::ERR_ABORTED 404 (Not Found)
GET http://www.valhatech.com/styles.365933d9cb35ac99c497.css net::ERR_ABORTED 404 (Not Found)
GET http://www.valhatech.com/polyfills-es2015.2987770fde9daa1d8a2e.js net::ERR_ABORTED 404 (Not Found)
我的index.html文件如下:
我的app.module.ts文件内容如下:
const routes: Routes = [
{ path: 'home', component: AppComponent },
{ path: '', redirectTo: 'home', pathMatch: 'full' },
{ path: '**', redirectTo: 'home' }
];
@NgModule({
declarations: [
AppComponent,
MckenzieGraphComponent
],
imports: [
BrowserModule,FormsModule,RouterModule.forRoot(routes, { useHash: true })
],
providers: [MckenzieEquationService],
bootstrap: [AppComponent]
})
export class AppModule { }
Firefox控制台显示的原因是:CORS请求不是HTTP错误或模块源的URI在此文档中未经授权:"file:///polyfills-es2015.2987770fde9daa1d8a2e.js"。