2017-04-17 1 views
4

이전 버전의 ng2 앱에서 Angular CLI (v1.0.0), Angular (v4.0.2) 및 관련 패키지를 업그레이드하여 최신 버전을 가져옵니다. 각도 재료의 때문에 변경을 깨는 여러 가지 다른 오류와 싸우고 후, 나는 빌드이 왼쪽 해요 :각도 4 빌드 오류 : 정적으로 기호 값을 확인하는 중 오류가 발생했습니다.

ERROR in Error encountered resolving symbol values statically. Only initialized variables and constants can be referenced because the value of this variable is needed by the template compiler (position 15:22 in the original .ts file),

resolving symbol ROUTES in /path/node_modules/@angular/router/src/router_config_loader.d.ts,

resolving symbol makeRootProviders in /path/node_modules/ui-router-ng2/lib/uiRouterNgModule.d.ts,

resolving symbol UIRouterModule.forRoot in /path/node_modules/ui-router-ng2/lib/uiRouterNgModule.d.ts,

resolving symbol AppModule in /path/src/app/app.module.ts,

resolving symbol AppModule in /path/src/app/app.module.ts

ERROR in ./src/main.ts Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/path/src' @ ./src/main.ts 5:0-74 @ multi ./src/main.ts

내가 오류가 (app.module.ts에서) 내 UIRouter의 설정을 포함 있다고 생각하지만 난 정말이야 확실하지 :

imports: [ 
    BrowserModule, 
    FormsModule, 
    HttpModule, 
    MaterialModule.forRoot(), 
    FlexLayoutModule, 
    UIRouterModule.forRoot({ 
     states: [ 
      homeState, 
      buttonsState, 
      colorState, 
      fontsState, 
      iconsState, 
      logosState, 
      messagingState, 
      typographyState 
     ], 
     useHash: false 
    }) 
], 

내가 처음가 해결 될 때 두 번째 오류는 사라질 것이라고 생각한다. UIRouterModule 구성을 반환하는 함수를 만들려고했으나 도움이되지 않았습니다. 도움을 주셨습니다.

답변

0

문제는 가져 오기 명령문에 있다고 생각합니다. 그것은 당신이처럼 .ts 파일 중 하나에 ROUTES를 가져 오려는 다음과 같습니다

import { ROUTES } from '@angular/router/src/router_config_loader';

모든 수입은 @angular/router하지 '@angular/router/src/router_config_loader'에서해야한다. 아마도 IDE에서 자동으로 상수를 가져 왔고 잘못된 경로가 사용되었습니다.

나는 비슷한 문제를 this SO answer으로 해결했습니다.

관련 문제