Typescript 找不到模块';角度2/核心和#x27;在Visual Studio 2015更新1中
在Visual Studio 2015 Update 1中试用angular2 beta版本时,我遇到此错误找不到模块“angular2/core” 代码如下:Typescript 找不到模块';角度2/核心和#x27;在Visual Studio 2015更新1中,typescript,angular,Typescript,Angular,在Visual Studio 2015 Update 1中试用angular2 beta版本时,我遇到此错误找不到模块“angular2/core” 代码如下: import {Component} from "angular2/core" @Component({ selector: 'my-app', template: '<h1>My First Angular 2 App</h1>' }) export class AppComponent {
import {Component} from "angular2/core"
@Component({
selector: 'my-app',
template: '<h1>My First Angular 2 App</h1>'
})
export class AppComponent {
}
更新:
我在tsconfig.json文件中添加了“moduleResolution”:“node”,但现在我得到了另一组错误:
1> ----已启动全部重建:项目:Terminal.Web,配置:
调试任何CPU------
1> C:\Test\node\u modules\angular2\typings\es6 shim\es6 shim.d.ts(6,14):
错误TS2300:生成:重复标识符“PropertyKey”。
1> C:\Test\node\u modules\angular2\typings\es6 shim\es6 shim.d.ts(9,5):
错误TS2300:生成:重复标识符“完成”。
1> C:\Test\node\u modules\angular2\typings\es6 shim\es6 shim.d.ts(10,5):
错误TS2300:生成:重复标识符“值”。
1> C:\Test\node\u modules\angular2\typings\es6 shim\es6 shim.d.ts(248,5):
错误TS2300:生成:重复标识符“EPSILON”。
1> C:\Test\node\u modules\angular2\typings\es6 shim\es6 shim.d.ts(283,5):
错误TS2300:生成:重复标识符“MAX\u SAFE\u INTEGER”。
1> C:\Test\node\u modules\angular2\typings\es6 shim\es6 shim.d.ts(290,5):
错误TS2300:生成:重复标识符“最小安全整数”。
1> C:\Test\node\u modules\angular2\typings\es6 shim\es6 shim.d.ts(346,5):
错误TS2300:生成:重复标识符“标志”。
1> C:\Test\node\u modules\angular2\typings\es6 shim\es6 shim.d.ts(498,5):
错误TS2300:生成:重复标识符“prototype”。
1> C:\Test\node\u modules\angular2\typings\es6 shim\es6 shim.d.ts(561,5):
错误TS2300:生成:重复标识符“大小”。
1> C:\Test\node\u modules\angular2\typings\es6 shim\es6 shim.d.ts(570,5):
错误TS2300:生成:重复标识符“prototype”。
1> C:\Test\node\u modules\angular2\typings\es6 shim\es6 shim.d.ts(581,5):
错误TS2300:生成:重复标识符“大小”。
1> C:\Test\node\u modules\angular2\typings\es6 shim\es6 shim.d.ts(590,5):
错误TS2300:生成:重复标识符“prototype”。
1> C:\Test\node\u modules\angular2\typings\es6 shim\es6 shim.d.ts(605,5):
错误TS2300:生成:重复标识符“prototype”。
1> C:\Test\node\u modules\angular2\typings\es6 shim\es6 shim.d.ts(619,5):
错误TS2300:生成:重复标识符“prototype”。1> C:\程序
文件(x86)\Microsoft SDK\TypeScript\1.7\lib.es6.d.ts(3841,14):错误
TS2300:生成:重复标识符“PropertyKey”。1> C:\程序文件
(x86)\Microsoft SDK\TypeScript\1.7\lib.es6.d.ts(4061,5):错误
TS2300:生成:重复标识符“EPSILON”。1> C:\程序文件
(x86)\Microsoft SDK\TypeScript\1.7\lib.es6.d.ts(4096,5):错误
TS2300:生成:重复标识符“最大安全整数”。1> C:\程序
文件(x86)\Microsoft SDK\TypeScript\1.7\lib.es6.d.ts(4103,5):错误
TS2300:生成:重复标识符“最小安全整数”。1> C:\程序
文件(x86)\Microsoft SDK\TypeScript\1.7\lib.es6.d.ts(4389,5):错误
TS2300:生成:重复标识符“完成”。1> C:\程序文件
(x86)\Microsoft SDK\TypeScript\1.7\lib.es6.d.ts(4390,5):错误
TS2300:生成:标识符“值”重复。1> C:\程序文件
(x86)\Microsoft SDK\TypeScript\1.7\lib.es6.d.ts(4619,5):错误
TS2300:生成:标识符“标志”重复。1> C:\程序文件
(x86)\Microsoft SDK\TypeScript\1.7\lib.es6.d.ts(4647,5):错误
TS2300:生成:重复标识符“大小”。1> C:\程序文件
(x86)\Microsoft SDK\TypeScript\1.7\lib.es6.d.ts(4657,5):错误
TS2300:生成:重复标识符“prototype”。1> C:\程序文件
(x86)\Microsoft SDK\TypeScript\1.7\lib.es6.d.ts(4674,5):错误
TS2300:生成:重复标识符“prototype”。1> C:\程序文件
(x86)\Microsoft SDK\TypeScript\1.7\lib.es6.d.ts(4686,5):错误
TS2300:生成:重复标识符“大小”。1> C:\程序文件
(x86)\Microsoft SDK\TypeScript\1.7\lib.es6.d.ts(4696,5):错误
TS2300:生成:重复标识符“prototype”。1> C:\程序文件
(x86)\Microsoft SDK\TypeScript\1.7\lib.es6.d.ts(4712,5):错误
TS2300:生成:重复标识符“prototype”。1> C:\程序文件
(x86)\Microsoft SDK\TypeScript\1.7\lib.es6.d.ts(5099,5):错误
TS2300:生成:重复标识符“prototype”。
=========全部重建:0成功,1失败,0跳过==========
在typings文件夹下找到browser.d.ts文件,并拖动到app.ts或项目中的任何ts文件中。
您将得到///reference xxxx,一些错误应该得到解决我也有同样的问题。我不知道到底是什么耍的花招
- 使用npm安装角度:
npm安装角度2 - 更新的Visual Studio扩展:
DotNetCore.1.0.0.RC2-VS2015Tools.Preview1
我发现tsconfig.json中的任何语法错误都会导致同样的问题,这很难理解。我在编译器选项的最后一个键末尾有一个逗号,这导致ts文件无法正确找到模块。尝试在tsconfig中添加
“moduleResolution”:“node”
。我编译了相同的示例,但使用了code和npm。它工作得很好,你能发布你的tsconfig.json文件吗?检查你在index.html
me中导入js文件的顺序,以面对同样的问题,但我在阅读此报告后已经解决了我的问题。希望它能帮助您找到错误第一:如果您没有集成system.import,那么您将如何设置引导文件(主组件)的入口点;第二:检查核心、通用等。。angular2文件夹中节点的模块\u模块捆绑包。这对于不同的stackoverflow问题修复了该问题。同意。我必须更新Visual Studio以更新3,然后从工具>扩展和更新>在线安装Typescript 2.2。
import {Component} from "angular2/bundles/angular2"
@Component({
selector: 'my-app',
template: '<h1>My First Angular 2 App</h1>'
})
export class AppComponent {
}
import {Component} from "../node_modules/angular2/core"
@Component({
selector: 'my-app',
template: "<h1>My First Angular 2 App</h1>"
})
export class AppComponent {
}
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": true,
"sourceMap": true,
"target": "es6",
"module": "system",
"emitDecoratorMetadata": true,
"experimentalDecorators": true
},
"exclude": [
"node_modules",
"wwwroot",
"bower_components"
]
}