2016-04-04 9 views
1

に動作します:私はnpm startでアプリを起動するとAngular2は、モジュールのangular2 /コア」を見つけることができませんが、アプリケーションは私が<code>app.component.ts</code>とAngular2で書かれたアプリを持っており、その中のいくつかの輸入を考える

import {Component} from 'angular2/core'; 

import {FiltersService} from "./services/filters-service"; 
import {SearchPipe} from "./pipes/header-pipe"; 
import {PaginationPipe} from "./pipes/pagination-pipe"; 


import {Header} from "./components/header/header.component"; 
import {Pagination} from "./components/pagination/pagination.component"; 
import {ConfigService} from "./services/config-service"; 
import {ResourceService} from "./services/resource-service"; 
import {HttpService} from "./services/http-service"; 

import 'rxjs/add/operator/map'; 
import {GlobalSearch} from "./components/global-search/global-search.component"; 
import {GlobalSearchPipe} from "./pipes/global-search-pipe"; 
import {CsvExport} from "./components/dropdown/csv-export.component"; 
import {HTTP_PROVIDERS} from "angular2/http"; 

、アプリが起動されますそして適切に動作しますが、コンソールに、私は取得しています:実際に

app/app.component.ts(1,25): error TS2307: Cannot find module 'angular2/core'. 
app/app.component.ts(18,30): error TS2307: Cannot find module 'angular2/http'. 

答えて

1

、2つの部分がここにあります

  • コンパイル部分は、タイピング(dtsファイル)に依存しています。これらのファイルが、使用されるオブジェクト/クラスの定義で見つからない場合は、コンパイルエラーが発生します。これにより、コンパイルプロセスは停止しません。詳細については、この質問を参照してください:No compilation error without d.ts files

  • ランタイム部分 JavaScriptファイルに依存します。対応するファイルがモジュールマネージャーに含まれているか使用可能な場合は、それらを使用することができます。

あなたのケースでは、編集中にcore.d.tsファイルにアクセスできると思います。 moduleResolutionプロパティの値をnodeに設定すると、コンパイラはnode_modulesフォルダー内で(tsc)それを探します。

関連する問題