2017-10-04 19 views
1

私の現在の角度プロジェクトは、角度がAOT機能をサポートする前に開始されました。今私はそれを働かせようとしています。次のエラーが表示されています。これが何を意味しているのか、問題のデバッグを開始できるのか分かりません。誰にもこのエラーが発生する理由はありますか?角度AOTビルド:内部エラー:不明な識別子は未定義です

"@angular/animations": "^4.4.4", 
"@angular/common": "^4.4.4", 
"@angular/compiler": "^4.4.4", 
"@angular/core": "^4.4.4", 
"@angular/forms": "^4.4.4", 
"@angular/platform-browser": "^4.4.4", 
"@angular/platform-browser-dynamic": "^4.4.4", 
"@angular/router": "^4.4.4", 
"@ngx-translate/core": "^8.0.0", 
"@ngx-translate/http-loader": "^2.0.0", 
"core-js": "^2.5.1", 
"font-awesome": "^4.7.0", 
"primeng": "^4.2.1", 
"quill": "^1.3.2", 
"rxjs": "^5.4.3", 
"zone.js": "^0.8.18" 

エラー

ERROR in Error: Internal error: unknown identifier undefined 
at Object.importExpr$$1 [as importExpr] (...\node_modules\@angular\compiler\bundles\compiler.umd.js:24211:23) 
at tokenExpr (...\node_modules\@angular\compiler\bundles\compiler.umd.js:18577:39) 
at providerDef (...\node_modules\@angular\compiler\bundles\compiler.umd.js:18480:20) 
at ...\node_modules\@angular\compiler\bundles\compiler.umd.js:18697:77 
at Array.map (<anonymous>) 
at NgModuleCompiler.compile (...\node_modules\@angular\compiler\bundles\compiler.umd.js:18697:44) 
at AotCompiler._compileModule (...\node_modules\@angular\compiler\bundles\compiler.umd.js:24144:32) 
at ...\node_modules\@angular\compiler\bundles\compiler.umd.js:24056:66 
at Array.forEach (<anonymous>) 
at AotCompiler._compileImplFile (...\node_modules\@angular\compiler\bundles\compiler.umd.js:24056:19) 
at ...\node_modules\@angular\compiler\bundles\compiler.umd.js:23969:87 
at Array.map (<anonymous>) 
at AotCompiler.emitAllImpls (...\node_modules\@angular\compiler\bundles\compiler.umd.js:23969:52) 
at CodeGenerator.emit (...\node_modules\@angular\compiler-cli\src\codegen.js:42:46) 
at ...\node_modules\@angular\compiler-cli\src\codegen.js:33:61 
at <anonymous> 
at process._tickCallback (internal/process/next_tick.js:188:7) 

答えて

1

で定義されていないテンプレートに変数を使用し、テンプレートをチェック:

export function windowFactory(): any { 
    return window; 
} 

providers: [{ 
    provide: Window, 
    useFactory: windowFactory 
}], 

Github: This fails with AoT compiler in Angular CLI, because Window (the browser window) is an interface

+0

こんにちは、プロバイダの工場を修正するためにあなたは何をしましたか? – Cristiano

+1

@Injectable() エクスポートクラスWindowWrapperは、Window { }エクスポート機能は、GetWindow(){ \t戻りウィンドウを拡張します。 } – im4ever

0

依存関係は、多分あなたは、アプリケーションのこの部分は、問題の原因となった部品

0

注入トークンの代わりに注入の日付を指定しようとしたときと同じエラーがありました。

providers: [ { provide: Date, useValue: new Date() } ]

をしてNOWこの

export const NOW = new InjectionToken<Date>('now');

ようにそれに依存したサービスで定義されている

providers: [ { provide: NOW, useValue: new Date() }, ],

にそれを変更:

だから私はやりました10

すべてはAngular siteで文書化されています。

関連する問題