2017-11-08 15 views
3

私はAngularアプリケーションをコンパイルしようとしていますが、エラーが発生しています。 コンパイラがindex.tsファイルを認識していないようです。なぜ私は分からない。以下はindex.tsはコンパイル出力の一部ではありません

は誤りです:

ERROR in ./node_modules/datatable/index.ts 
Module build failed: Error: node_modules\datatable\index.ts is not part of the compilation output. Please check the other error messages for details. 
    at AngularCompilerPlugin.getCompiledFile (node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:629:23) 
    at plugin.done.then (node_modules\@ngtools\webpack\src\loader.js:467:39) 
    at process._tickCallback (internal/process/next_tick.js:103:7) 
@ ./src/main/ui/app/app.module.ts 13:0-59 
@ ./src/main.ts 
@ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts 
ERROR in ./node_modules/typeahead/index.ts 
Module build failed: Error: node_modules\typeahead\index.ts is not part of the compilation output. Please check the other error messages for details. 
    at AngularCompilerPlugin.getCompiledFile (\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:629:23) 
    at plugin.done.then (node_modules\@ngtools\webpack\src\loader.js:467:39) 
    at process._tickCallback (internal/process/next_tick.js:103:7) 
@ ./src/main/ui/app/app.module.ts 12:0-59 
@ ./src/main.ts 
@ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts 

誰もがこの問題を解決する方法上の任意の提案を持っていますか? ありがとうございます。

答えて

1

これは単純なFIX-は、次のことを実行しました: NPMがインストール--save @ ngtools/WebPACKの1.2.4

+0

なぜ特定のバージョンをインストールするのですか? –

+0

具体的な理由はありませんでしたが、Googleでこの提案が見つかりました。それは私のために働いた。 –

2

@私は角度-ブートストラップ-MDの\のindex.tsと同様の問題がありました

how I could fix it:

Just put the index.ts file to the tsconfig.jsons include block , see below:

{ 
    "compileOnSave": false, 
    "compilerOptions": { 
    "outDir": "./dist/out-tsc", 
    "sourceMap": true, 
    "declaration": false, 
    "moduleResolution": "node", 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "target": "es5", 
    "typeRoots": [ 
    "node_modules/@types" 
    ], 
    "lib": [ 
    "es2017", 
    "dom" 
    ] 
}, 
"include": [ 
    "src/**/*", 
    "node_modules/angular-bootstrap-md/index.ts" 
    ] 
} 

Source: https://github.com/angular/angular/issues/20091

+0

ありがとう!私はwebpackをインストールすることでそれを修正することができました。それは私が見逃していたようだ。あなたの助けに感謝。 –

0

アプリケーションディレクトリは、%ユーザー%\ Documentsディレクトリの下のどこかにいたとき、私は同様の問題がありました。ディレクトリ全体を別のパス(C:\ Data \ Angularなど)にコピーした後、エラーはなくなりました。

1

なぜこれが最初に起こっているのかを明確にする。パブリッシュされたモジュールにtypescriptファイルがある場合、コンパイラはコンパイルされたjavascriptファイルの代わりにそれらをロードしようとします。

唯一のtsファイルは定義のもの(*.d.ts)でなければならないので、これは明らかに公開プロセスの間違いです。

これらの(先行入力およびデータテーブル)があなたのパッケージである場合は、.npmignoreファイルを確認してください。 .d.tsを除くすべての.tsファイルは無視する必要があります。彼らがあなたのものでない場合は、これを親切にして作成者/所有者に報告してください。

関連する問題