爲了引入更新的版本,我正在升級以前可用的ng2應用中的Angular CLI(v1.0.0),Angular(v4.0.2)和相關軟件包角材料。與因重大更改幾個其他錯誤戰鬥後,我留下了這樣的構建:Angular 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.tsERROR 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
我相信,錯誤涉及我UIRouter配置(在app.module.ts),但我真的很不知道:
imports: [
BrowserModule,
FormsModule,
HttpModule,
MaterialModule.forRoot(),
FlexLayoutModule,
UIRouterModule.forRoot({
states: [
homeState,
buttonsState,
colorState,
fontsState,
iconsState,
logosState,
messagingState,
typographyState
],
useHash: false
})
],
我懷疑第一個問題解決後,第二個錯誤將消失。我試圖創建一個返回UIRouterModule配置的函數,但這沒有幫助。援助感謝。