구축 :오류가 나는 각 CLI 버전 1.5.2이 명령을 사용하여 생산을위한 각 버전 5 응용 프로그램 구축을 위해 노력하고
ng build --prod
그러나 그것은 나에게이 오류 제공 :
을ERROR in Error: Error encountered resolving symbol values statically. Calling fu nction 'FlashMessagesModule', function calls are not supported. Consider replaci ng the function or lambda with a reference to an exported function, resolving sy mbol AppModule in D:/Project/mean-auth-app/angular-src/src/app/app.module.ts, re solving symbol AppModule in D:/Project/mean-auth-app/angular-src/src/app/app.mod ule.ts
angular 버전 v5.0이 angular2-flash-messages 모듈 버전 2.0.0과 충돌합니다. 나는 플래시 메시지 모듈을 설치하고 설정하는 것과 정확히 똑같은 것을했다. here. 검색했지만 유용한 힌트를 찾을 수 없었습니다. 어떤 사람들은 그것을 버그라고 부르며, 문제가되는 패키지를 설치 제거하거나 설치하면 어떤 사람들은 문제를 해결할 수 있습니다.
내 응용 프로그램 모듈 :
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { RouterModule, Routes } from '@angular/router';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
import { NavbarComponent } from './components/navbar/navbar.component';
import { LoginComponent } from './components/login/login.component';
import { RegisterComponent } from './components/register/register.component';
import { HomeComponent } from './components/home/home.component';
import { DashboardComponent } from './components/dashboard/dashboard.component';
import { ProfileComponent } from './components/profile/profile.component';
import { AccountService } from './services/account.service';
import { FlashMessagesModule } from 'angular2-flash-messages';
import { JwtModule } from '@auth0/angular-jwt';
import { HttpClientModule } from '@angular/common/http';
import { AuthGuard } from './services/auth-guard.service';
const routes = [
{ path: '', component: HomeComponent },
{ path: 'register', component: RegisterComponent },
{ path: 'login', component: LoginComponent },
{ path: 'dashboard', component: DashboardComponent, canActivate: [AuthGuard]},
{ path: 'profile', component: ProfileComponent, canActivate: [AuthGuard]}
];
@NgModule({
declarations: [
AppComponent,
NavbarComponent,
LoginComponent,
RegisterComponent,
HomeComponent,
DashboardComponent,
ProfileComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
FlashMessagesModule.forRoot(),
RouterModule.forRoot(routes),
HttpClientModule,
JwtModule.forRoot({
config: {
tokenGetter:() => {
return localStorage.getItem('token');
},
whitelistedDomains: ['localhost:4200']
}
})
],
providers: [AccountService, AuthGuard],
bootstrap: [AppComponent]
})
export class AppModule { }
나는이 문제를 해결하기 위해 어떤 힌트를 주셔서 감사합니다.
는 말한다 : 당신은 실내 장식에 람다 기능을 사용할 수 없습니다. 'tokenGetter'가 참조하는 내 보낸 함수로 다시 작성하십시오. – Dinistro
@Dinistro 답장을 보내 주셔서 감사합니다. 그러나 그것은 FlashMessagesModule을 언급했다. –
'FlashMessagesModule'은이 에러의 원인이 아니다. – Dinistro