2016-09-14 8 views
8

Angular 2 CLIを使用してAngular 2プロジェクトを作成し、ng build --prodコマンドを使用してエラーが発生しました。Uncaught TypeError:this._input.charCodeAtは関数ではありません

enter image description here

Uncaught TypeError: this._input.charCodeAt is not a function_Tokenizer._advance @ main .688167 c….bundle.js: 1716 _Tokenizer @ main .688167 c….bundle.js: 1716 tokenize @ main .688167 c….bundle.js: 1709 Parser.parse @ main .688167 c….bundle.js: 219 HtmlParser.parse @ main .688167 c….bundle.js: 380 DirectiveNormalizer.normalizeLoadedTemplate @ main .688167 c….bundle.js: 598 DirectiveNormalizer.normalizeTemplateSync @ main .688167 c….bundle.js: 598 DirectiveNormalizer.normalizeDirective @ main .688167 c….bundle.js: 598 RuntimeCompiler._createCompiledTemplate @ main .688167 c….bundle.js: 1090(anonymous 
function) @ main .688167 c….bundle.js: 1090(anonymous 
function) @ main .688167 c….bundle.js: 1090 RuntimeCompiler._compileComponents @ main .688167 c….bundle.js: 1090 RuntimeCompiler._compileModuleAndComponents @ main .688167 c….bundle.js: 1090 RuntimeCompiler.compileModuleAsync @ main .688167 c….bundle.js: 1090 PlatformRef_._bootstrapModuleWithZone @ main .688167 c….bundle.js: 717 PlatformRef_.bootstrapModule @ main .688167 c….bundle.js: 717(anonymous 
function) @ main .688167 c….bundle.js: 1509 __webpack_require__ @ inline.js: 1(anonymous 
function) @ main .688167 c….bundle.js: 2131 __webpack_require__ @ inline.js: 1 window.webpackJsonp @ inline.js: 1(anonymous 
function) @ main .688167 c….bundle.js: 1 

私はWebPACKのと角2と最新の角度2 CLIを使用しています:私は私のウェブサイトにdistフォルダをアップロード

は、私は、アプリの負荷が次のエラーを取得しますRC.7

何が間違っていた可能性がありますか?

this._input.charCodeAtのみ以下のように角度コンパイラフォルダに使用されている: enter image description here

+0

ケア? :P – rinukkusu

+0

次回は、スタックトレースを正しくフォーマットしてください。私たち自身で行う必要はありません。 – mic4ael

+0

@rinukkuu 20以上のコンポーネントを持つApp ..私はそうは思わない。 – TheUnreal

答えて

44

代わりに、テンプレートのローディング・コンポーネント・コードによって引き起こされることがある、すなわち

templateUrl: 'my.component' 

代わりに

templateUrl: 'my.component.html' 
+2

私の日を救ったと言いました。 – Spock

+0

また、私の日を救った! – Steoates

0

次のデバッグコードは、誤ってインポートされたテンプレートを見つけるのに役立ちました。

コンパイラの_Tokenizerあなた./node_modules/@angular/compiler/bundles/compiler.umd.js(または使用されている他のバンドル)内に次のスニペットを注入:

function _Tokenizer(_file, _getTagDefinition, _tokenizeIcu, _interpolationConfig) { 
    // ... 
    try { 
     this._advance(); 
    } catch (e) { 
     console.log('[Tokenizer Error]: ' + _file && JSON.stringify(_file, null, 2)); 
     throw e; 
    } 
} 

は、一例として、スクリーンショットを参照してください:あなたのコードを共有する

enter image description here

関連する問題