Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/427.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 角度5+;非法状态:无法加载指令RouterOutlet的摘要_Javascript_Angular_Typescript_Angular Router_Ng Build - Fatal编程技术网

Javascript 角度5+;非法状态:无法加载指令RouterOutlet的摘要

Javascript 角度5+;非法状态:无法加载指令RouterOutlet的摘要,javascript,angular,typescript,angular-router,ng-build,Javascript,Angular,Typescript,Angular Router,Ng Build,如果我尝试使用ng build--prod--aot构建Angular应用程序,我总是会遇到以下错误: 错误:非法状态:无法加载C:/Project/node\u modules/@angular/Router/Router.d.ts路径中的指令RouterOutlet摘要。 如果我用“ng serve”编译我的项目,我不会收到错误消息。我试图实现几种不同的延迟加载,但每一种都会导致错误。此外,我试图完全重建应用程序,并保持Angular的所有规格,但我总是返回到这个错误消息相同的点 My pa

如果我尝试使用ng build--prod--aot构建Angular应用程序,我总是会遇到以下错误:

错误:非法状态:无法加载C:/Project/node\u modules/@angular/Router/Router.d.ts路径中的指令RouterOutlet摘要。

如果我用“ng serve”编译我的项目,我不会收到错误消息。我试图实现几种不同的延迟加载,但每一种都会导致错误。此外,我试图完全重建应用程序,并保持Angular的所有规格,但我总是返回到这个错误消息相同的点

My package.json:

{
“名称”:“名称”,
“版本”:“0.0.0”,
“许可证”:“麻省理工学院”,
“脚本”:{
“ng”:“ng”,
“开始”:“ng发球”,
“构建”:“ng构建--prod”,
“测试”:“ng测试”,
“皮棉”:“ng皮棉”,
“e2e”:“ng e2e”
},
“私人”:没错,
“依赖项”:{
“@angular/animations”:“^5.2.0”,
“@angular/common”:“^5.2.0”,
“@angular/compiler”:“^5.2.0”,
“@angular/core”:“^5.2.0”,
“@angular/forms”:“^5.2.0”,
“@angular/http”:“^5.2.0”,
“@angular/platform浏览器”:“^5.2.0”,
“@angular/platform browser dynamic”:“^5.2.0”,
“@angular/router”:“^5.2.0”,
“核心js”:“^2.4.1”,
“rxjs”:“^5.5.6”,
“zone.js”:“^0.8.19”
},
“依赖性”:{
“@angular/cli”:“~1.7.4”,
“@angular/compiler cli”:“^5.2.0”,
“@angular/language service”:“^5.2.0”,
“@types/jasmine”:“~2.8.3”,
“@types/jasminewd2”:“~2.0.2”,
“@types/node”:“~6.0.60”,
“codelyzer”:“^4.0.1”,
“茉莉花芯”:“~2.8.0”,
“jasmine spec reporter”:“~4.2.1”,
“因果报应”:“~2.0.0”,
“卡玛铬发射器”:“~2.2.0”,
“因果报应报道伊斯坦布尔记者”:“^1.2.1”,
“因果报应茉莉”:“~1.1.0”,
“karma jasmine html reporter”:“^0.2.2”,
“量角器”:“~5.1.2”,
“ts节点”:“~4.1.0”,
“tslint”:“~5.9.1”,
“类型脚本”:“~2.5.3”
}
我的app.module.ts:

从'@angular/platform browser'导入{BrowserModule};
从“@angular/core”导入{NgModule};
从'@angular/common/http'导入{HttpClientModule};
从'@angular/Router'导入{Routes,RouterModule};
从'@angular/forms'导入{ReactiveFormsModule};
从“./app.component”导入{AppComponent};
从“./app routing.module”导入{AppRoutingModule};
从“./Core/Core.module”导入{CoreModule};
//从“./protokoll/protokoll.module”导入{ProtkollModule};
@NGD模块({
声明:[
应用组件,
],
进口:[
浏览器模块,
批准模块,
核心模块,
],
提供者:[],
引导:[AppComponent]
})
导出类AppModule{}
My app-routing.module.ts:

从'@angular/core'导入{NgModule};
从'@angular/Router'导入{Routes,RouterModule};
从“./app.component”导入{AppComponent};
从“./Core/login/login.component”导入{LoginComponent};
从“./Core/login/auth guard.service”导入{AuthGuardService};
从“./admin/admin.component”导入{AdminComponent};
从“./Core/error/error.component”导入{ErrorComponent};
施工许可:路线=[
{路径:'',组件:AppComponent,路径匹配:'full'},
{path:'login',pathMatch:'full',component:LoginComponent},
{path:'freigabe',loadChildren:'./产品列表/产品列表.模块#产品列表模块',可加载:[AuthGuardService]},
{path:'protokoll',loadChildren:'./protokoll/protokoll.module#protokollmodule',canLoad:[AuthGuardService]},
{路径:'admin',组件:AdminComponent,canActivate:[AuthGuardService]},
{path:'error',component:ErrorComponent},
{路径:'**',重定向到:'}
];
@NGD模块({
导入:[RouterModule.forRoot(批准)],
导出:[路由模块],
})
导出类AppRoutingModule{}
My product-list.module:

从'@angular/core'导入{NgModule};
从“@angular/common”导入{CommonModule};
从'@angular/Router'导入{Routes,RouterModule};
从“./buttons/release button/release button.component”导入{ReleaseButtonComponent};
从“./buttons/sync button/sync button.component”导入{SyncButtonComponent};
从“./buttons/rollback button/rollback button.component”导入{RollbackButtonComponent};
从“./product list.component”导入{ProductListComponent};
从“./link generator/link generator.component”导入{LinkGeneratorComponent};
从“./search products/search products.component”导入{SearchProductsComponent};
从“./product/product.component”导入{ProductComponent};
从“./product/underproduct/underproduct.component”导入{UnderproductComponent};
从“./product/version/version.component”导入{VersionComponent};
从“./product/release/release.component”导入{ReleaseComponent};
从“./buttons/set button class.directive”导入{SetButtonClassDirective};
从“./buttons/button.service”导入{ButtonService};
从“./buttons/button create.service”导入{ButtonCreateService};
从“./product/list-toggle.service”导入{ListToggleService};
从“./link generator/link generator.service”导入{LinkGeneratorService};
从“./product list.service”导入{PRODUCTLISTSSERVICE};
从“./buttons/spinner/spinner.component”导入{SpinnerComponent};
const productListRoutes:路由=[
{路径:'',组件:ProductListComponent},
];
@NGD模块({
声明:[
释放按钮组件,
SyncButton组件,
回滚按钮组件,
ProductListComponent,
链接生成器组件,
SearchProductsComponent,
产品组件,
生产不足部分,
版本组件,
释放组件,
SetButtonClassDirective,
],
进口:[
公共模块,
RouterModule.forChild(productListRoutes)
],
供应商:[
按钮服务,
按钮创建服务,
ListToggleService,
链接
beforeEach(fakeAsync(() => {
    TestBed.configureTestingModule({
     declarations: [
      RegisterComponent
     ],
     providers: [
      ApiService,
      AuthService,
      FormBuilder
     ]
    }).overrideComponent(RegisterComponent, {
     set: {
      providers: [{
       provide: ApiService,
       useClass: MockApiService
      }]
     }
    }).compileComponents().then(() => {
     componentFixture = TestBed.createComponent(RegisterComponent);
     component = componentFixture.componentInstance;
    });
Uncaught Error: Illegal state: Could not load the summary for directive MyComponent
declarations:[
      ...components....
      MyComponent  // <- adding this GOT RID of the ISSUE
]