When running ng serve with a successful compilation in my Angular app, I started getting the following error in the browser console.
(当在Angular应用中运行ng serve并成功编译时,我开始在浏览器控制台中收到以下错误。)
AppComponent_Host.ngfactory.js? [sm]:1 ERROR Error: Arguments array must have arguments.
at injectArgs (core.js:1412)
at core.js:1491
at _callFactory (core.js:8438)
at _createProviderInstance (core.js:8396)
at resolveNgModuleDep (core.js:8371)
at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get
(core.js:9064)
at resolveDep (core.js:9429)
at createClass (core.js:9309)
at createDirectiveInstance (core.js:9186)
at createViewNodes (core.js:10406)
This as far as I can tell from Main.ts platformBrowserDynamic().bootstrapModule(AppModule) .catch(err => console.log(err));
(据我从Main.ts platformBrowserDynamic().bootstrapModule(AppModule) .catch(err => console.log(err));
得知,BrowserDynamic platformBrowserDynamic().bootstrapModule(AppModule) .catch(err => console.log(err));
)
I have deleted the node modules folder and reinstalled and I'm having trouble with the lack of explanation the error gives.
(我已删除节点模块文件夹并重新安装,但由于错误给出的解释不足,我遇到了麻烦。)
Plus, I'm somewhat new to Angular.(另外,我对Angular还是有些陌生。)
Any help would be greatly appreciated.
(任何帮助将不胜感激。)
EDIT(编辑)
I ran ng serve --aot
and got the following error
(我ng serve --aot
并出现以下错误)
ERROR in : Error: Internal error: unknown identifier []
at Object.importExpr$$1 [as importExpr] (C:UserskgDocumentsang2adUI
[email protected]:21731:27)
at C:UserskgDocumentsang2adUI
[email protected]:9988:37
at Array.map (<anonymous>)
at InjectableCompiler.depsArray (C:UserskgDocumentsang2adUI
[email protected]:9954:25)
at InjectableCompiler.factoryFor (C:UserskgDocumentsang2adUI
[email protected]:10018:36)
at InjectableCompiler.injectableDef (C:UserskgDocumentsang2adUI
[email protected]:10037:42)
at InjectableCompiler.compile (C:UserskgDocumentsang2adUI
[email protected]:10047:106)
at C:UserskgDocumentsang2adUI
[email protected]:21576:90
at Array.forEach (<anonymous>)
at AotCompiler._emitPartialModule2 (C:UserskgDocumentsang2adUI
[email protected]:21576:25)
at C:UserskgDocumentsang2adUI
[email protected]:21569:48
at Array.reduce (<anonymous>)
at AotCompiler.emitAllPartialModules2 (C:UserskgDocumentsang2adUI
[email protected]:21568:26)
at AngularCompilerProgram._emitRender2 (C:UserskgDocumentsang2adUI
[email protected]:364:31)
at AngularCompilerProgram.emit (C:UserskgDocumentsang2adUI
[email protected]:236:22)
at AngularCompilerPlugin._emit (C:UserskgDocumentsang2adUI
ode_modules@ngtoolswebpacksrcangular_compiler_plugin.js:846:49)
ngModule(ngModule)
@NgModule({
declarations: [
AppComponent,
LoginComponent,
ItemDashboardComponent,
UnprotectedSearchComponent,
HomeComponent,
UnprotectedResultsComponent,
DashboardComponent,
TrackingListComponent,
ListItemComponent,
ActionItemComponent,
ActionListComponent,
ItemInfoTableComponent,
TrackingInfoTableComponent,
FilterPipe,
RegisterItemsComponent,
RegisterPackageComponent,
AddItemsPackageComponent,
ChangeCustodyComponent,
CheckTempComponent,
RemoveItemsComponent,
ScannerComponent,
ContainerDashboardComponent,
SoldComponent
],
imports: [
NgQrScannerModule,
MatTabsModule,
AngularFontAwesomeModule,
MatListModule,
MatFormFieldModule,
BrowserAnimationsModule,
MatMenuModule,
MatProgressBarModule,
BrowserModule,
MatIconModule,
MatGridListModule,
AngularFontAwesomeModule,
FormsModule,
AppRoutingModule,
HttpClientModule,
RouterModule.forRoot([
{
path: 'home',
component: HomeComponent
},
//{path: 'openSearch', component: LoginComponent},
{
path: 'item',
component: ItemDashboardComponent,
canActivate: [AuthGuard, ManufacturerAuthGuardService]
},
{
path: 'dashboard',
component: DashboardComponent,
canActivate: [AuthGuard]
},
{
path: 'unprotectedResults',
component: UnprotectedResultsComponent,
canActivate: [AuthGuard]
},
{
path: 'trackingList/'+environment.config.itemWorkflow+'/:contractId',
component: ItemDashboardComponent,
canActivate: [AuthGuard]
},
{
path: 'trackingList/'+environment.config.packageWorkflow+'/:contractId',
component: ContainerDashboardComponent,
canActivate: [AuthGuard]
},
{
path: 'trackingList',
component: TrackingListComponent,
canActivate: [AuthGuard]
},
{
path: 'actions',
component: ActionListComponent,
canActivate: [AuthGuard]
},
{
path: 'publicResults/:contractId',
component: UnprotectedResultsComponent
},
{
path: 'registerItems',
component: RegisterItemsComponent,
canActivate: [AuthGuard]
},
{
path: 'addItemsToPackage',
component: AddItemsPackageComponent,
canActivate: [AuthGuard]
},
{
path: 'registerPackage',
component: RegisterPackageComponent,
canActivate: [AuthGuard]
},
{
path: 'changeCustody/:contractId',
component: ChangeCustodyComponent,
canActivate: [AuthGuard]
},
{
path: 'changeCustody',
component: ChangeCustodyComponent,
canActivate: [AuthGuard]
},
{
path: 'checkTemp',
component: CheckTempComponent,
canActivate: [AuthGuard]
},
{
path: 'removeItems',
component: RemoveItemsComponent,
canActivate: [AuthGuard]
},
{
path: 'sellItems',
component: SoldComponent,
canActivate: [AuthGuard]
},
]),
UiModule
],
providers: [
AuthGuard,
{
provide: HTTP_INTERCEPTORS,
useClass: MyInterceptor,
multi: true
},
MockBackend,
fakeBackendProvider,
BaseRequestOptions,
AuthGuard,
AdminAuthGuard,
AdalService,
SoldComponent
],
bootstrap: [AppComponent]
})
AppComponent Constructor(AppComponent构造函数)
constructor(private api: ApiService, private adalService: AdalService, private _http: HttpClient, private router: Router, public authService: AuthService) {
this.adalService.init(environment.config);
if (!this.adalService.userInfo.authenticated) this.router.navigate(['/']);
}
ask by kg123 translate from so