当我尝试构建我的应用时,出现以下错误:
1>node_modules\angular2\typings\browser.d.ts(6,14): error TS2300: Build: Duplicate identifier 'PromiseConstructor'.
1>node_modules\angular2\typings\es6-collections\es6-collections.d.ts(22,5): error TS2300: Build: Duplicate identifier 'done'.
1>node_modules\angular2\typings\es6-collections\es6-collections.d.ts(23,5): error TS2300: Build: Duplicate identifier 'value'.
1>node_modules\angular2\typings\es6-collections\es6-collections.d.ts(46,5): error TS2300: Build: Duplicate identifier 'size'.
1>node_modules\angular2\typings\es6-collections\es6-collections.d.ts(52,5): error TS2300: Build: Duplicate identifier 'prototype'.
1>node_modules\angular2\typings\es6-collections\es6-collections.d.ts(66,5): error TS2300: Build: Duplicate identifier 'size'.
1>node_modules\angular2\typings\es6-collections\es6-collections.d.ts(72,5): error TS2300: Build: Duplicate identifier 'prototype'.
1>node_modules\angular2\typings\es6-collections\es6-collections.d.ts(88,5): error TS2300: Build: Duplicate identifier 'prototype'.
1>node_modules\angular2\typings\es6-collections\es6-collections.d.ts(103,5): error TS2300: Build: Duplicate identifier 'prototype'.
1>node_modules\angular2\typings\es6-promise\es6-promise.d.ts(11,15): error TS2300: Build: Duplicate identifier 'Promise'.
1>node_modules\angular2\typings\es6-promise\es6-promise.d.ts(42,16): error TS2300: Build: Duplicate identifier 'Promise'.
我不明白为什么。这是我的tsconfig:
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"noEmitOnError": true,
"noImplicitAny": false,
"outDir": "../wwwroot/appScripts/",
"removeComments": false,
"sourceMap": true,
"target": "es5"
},
"exclude": [
"node_modules"
]
}
我不知道为什么会收到此错误。我遵循了本教程:http://www.mithunvp.com/angular-2-in-asp-net-5-typescript-visual-studio-2015/
答案 0 :(得分:0)
检查你的es6-collections.d.ts是不止一次导入的。当引用多次出现时会发生此类问题。