此應用程序使用jspm for javascript模塊加載,所以所有的angular2 typescript定義文件都在jspm_modules文件夾中。我得到的錯誤,Typescript無法找到模塊'angular/core','angular/route','angular/http'等。我在VS 2015編輯器中遇到了錯誤,當我運行我的構建版本時,使用gulp-typingcript 。我想,也許是因爲我有我的tsconfig.json jspm_packages:Typescript Angular2錯誤找不到模塊angular/x
{
"version": 3,
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"wwwroot/jspm_packages",
"wwwroot/app"
]
}
但是,如果我去掉那行,我得到各類重名的錯誤。我試着按照其他類似問題的建議編輯我的xproj文件,但無濟於事。任何想法如何解決這個問題?
的源代碼可在github。
https://github.com/ryanlangton/angular2-asp5-starter/tree/typescript-errors
我認爲'package.json'目錄中的'npm install'應該解決這個問題。 TypeScript Compiler會自動在你的'node_modules'中找到類型定義 –