Angularjs Angular2-错误TS2300:重复标识符';承诺建造商';
在main.ts中,我包括以下解决方法 在我的index.html的脑袋里Angularjs Angular2-错误TS2300:重复标识符';承诺建造商';,angularjs,angular,Angularjs,Angular,在main.ts中,我包括以下解决方法 在我的index.html的脑袋里 app.use('/scripts', express.static(__dirname + '/node_modules')); <!-- 1. Load libraries --> <!-- IE required polyfills, in this exact order --> <script src="/scripts/es6-shim/es6-
app.use('/scripts', express.static(__dirname + '/node_modules'));
<!-- 1. Load libraries -->
<!-- IE required polyfills, in this exact order -->
<script src="/scripts/es6-shim/es6-shim.min.js"></script>
<script src="/scripts/systemjs/dist/system-polyfills.js"></script>
<script src="/scripts/angular2/es6/dev/src/testing/shims_for_IE.js"></script>
<script src="/scripts/angular2/bundles/angular2-polyfills.js"></script>
<script src="/scripts/systemjs/dist/system.src.js"></script>
<script src="/scripts/rxjs/bundles/Rx.js"></script>
<script src="/scripts/angular2/bundles/angular2.dev.js"></script>
<!-- 2. Configure SystemJS -->
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('../js/acApp/main.ts')
.then(null, console.error.bind(console));
</script>
但我仍然有重复的错误。有什么想法吗
[0] 16:47:12 - File change detected. Starting incremental compilation...
[0] node_modules/angular2/typings/browser.d.ts(6,14): error TS2300: Duplicate identifier 'PromiseConstructor'.
[0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(22,5): error TS2300: Duplicate identifier 'done'.
[0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(23,5): error TS2300: Duplicate identifier 'value'.
[0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(46,5): error TS2300: Duplicate identifier 'size'.
[0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(52,5): error TS2300: Duplicate identifier 'prototype'.
[0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(66,5): error TS2300: Duplicate identifier 'size'.
[0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(72,5): error TS2300: Duplicate identifier 'prototype'.
[0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(88,5): error TS2300: Duplicate identifier 'prototype'.
[0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(103,5): error TS2300: Duplicate identifier 'prototype'.
[0] node_modules/angular2/typings/es6-promise/es6-promise.d.ts(11,15): error TS2300: Duplicate identifier 'Promise'.
[0] node_modules/angular2/typings/es6-promise/es6-promise.d.ts(42,16): error TS2300: Duplicate identifier 'Promise'.
[0] public/js/acApp/app.component.ts(3,2): error TS2304: Cannot find name 'Component'.
[0] public/js/acApp/app.component.ts(8,2): error TS2304: Cannot find name 'View'.
[0] public/js/acApp/app.component.ts(21,16): error TS2304: Cannot find name 'RouterOutlet'.
[0] public/js/acApp/app.component.ts(23,2): error TS2304: Cannot find name 'RouteConfig'.
[0] public/js/acApp/app.component.ts(24,69): error TS2304: Cannot find name 'UserTimelineComponent'.
[0] typings/main/ambient/es6-shim/index.d.ts(11,5): error TS2300: Duplicate identifier 'done'.
[0] typings/main/ambient/es6-shim/index.d.ts(12,5): error TS2300: Duplicate identifier 'value'.
[0] typings/main/ambient/es6-shim/index.d.ts(477,11): error TS2300: Duplicate identifier 'Promise'.
[0] typings/main/ambient/es6-shim/index.d.ts(496,11): error TS2300: Duplicate identifier 'PromiseConstructor'.
[0] typings/main/ambient/es6-shim/index.d.ts(554,13): error TS2300: Duplicate identifier 'Promise'.
[0] typings/main/ambient/es6-shim/index.d.ts(563,5): error TS2300: Duplicate identifier 'size'.
[0] typings/main/ambient/es6-shim/index.d.ts(572,5): error TS2300: Duplicate identifier 'prototype'.
[0] typings/main/ambient/es6-shim/index.d.ts(583,5): error TS2300: Duplicate identifier 'size'.
[0] typings/main/ambient/es6-shim/index.d.ts(592,5): error TS2300: Duplicate identifier 'prototype'.
[0] typings/main/ambient/es6-shim/index.d.ts(607,5): error TS2300: Duplicate identifier 'prototype'.
[0] typings/main/ambient/es6-shim/index.d.ts(621,5): error TS2300: Duplicate identifier 'prototype'.
更新
@埃里克
Tks。我从angular2文件夹中删除browser.d.ts。复制错误消失了。然后,我必须删除//
,因为这将导致文件未找到错误。剩下的错误是
[0] public/js/acApp/app.component.ts(3,2): error TS2304: Cannot find name 'Component'.
[0] public/js/acApp/app.component.ts(8,2): error TS2304: Cannot find name 'View'.
[0] public/js/acApp/app.component.ts(21,16): error TS2304: Cannot find name 'RouterOutlet'.
[0] public/js/acApp/app.component.ts(23,2): error TS2304: Cannot find name 'RouteConfig'.
[0] public/js/acApp/app.component.ts(24,69): error TS2304: Cannot find name 'UserTimelineComponent'.
我的文件夹结构是
-node_modules
-public
--js
---acApp
----main.ts
----app.component.js
错误请尝试从打字中删除
es6承诺
和es6集合
,typings卸载es6承诺--save
和typings卸载es6集合--save
。es6 shim typings已经有了另外两个的类型。你不能按照我上面建议的那样做,那些来自angular2的文件夹--,抱歉。删除angular2文件夹中对browser.d.ts
的引用,您应该会没事。否,这将导致其他错误[0]节点_模块/rxjs/Rx.d.ts(7,30):错误TS2307:找不到模块。/subject/AsyncSubject'。[0]节点_modules/rxjs/Rx.d.ts(8,31):错误TS2307:找不到模块'./subject/ReplaySubject'。[0]节点_modules/rxjs/Rx.d.ts(9,33):错误TS2307:找不到模块'./subject/BehaviorSubject'。[0]节点_modules/rxjs/Rx.d.ts(12,28):错误TS2307:找不到模块'./util/EmptyError'。[0]节点_modules/rxjs/Rx.d.ts(13,41):错误TS2307:找不到模块'./util/ArgumentOutOfRangeError'。您在那里遇到了一些奇怪的问题。您不应该看到这些错误,您只需要es6垫片打字。该错误还显示类似于TS2304:找不到名称“Component”
,因此您在那里遇到了一些奇怪的问题。你能添加typings.json文件吗?你的更新让我觉得你的设置没有读取tsconfig.json。
[0] 16:47:12 - File change detected. Starting incremental compilation...
[0] node_modules/angular2/typings/browser.d.ts(6,14): error TS2300: Duplicate identifier 'PromiseConstructor'.
[0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(22,5): error TS2300: Duplicate identifier 'done'.
[0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(23,5): error TS2300: Duplicate identifier 'value'.
[0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(46,5): error TS2300: Duplicate identifier 'size'.
[0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(52,5): error TS2300: Duplicate identifier 'prototype'.
[0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(66,5): error TS2300: Duplicate identifier 'size'.
[0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(72,5): error TS2300: Duplicate identifier 'prototype'.
[0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(88,5): error TS2300: Duplicate identifier 'prototype'.
[0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(103,5): error TS2300: Duplicate identifier 'prototype'.
[0] node_modules/angular2/typings/es6-promise/es6-promise.d.ts(11,15): error TS2300: Duplicate identifier 'Promise'.
[0] node_modules/angular2/typings/es6-promise/es6-promise.d.ts(42,16): error TS2300: Duplicate identifier 'Promise'.
[0] public/js/acApp/app.component.ts(3,2): error TS2304: Cannot find name 'Component'.
[0] public/js/acApp/app.component.ts(8,2): error TS2304: Cannot find name 'View'.
[0] public/js/acApp/app.component.ts(21,16): error TS2304: Cannot find name 'RouterOutlet'.
[0] public/js/acApp/app.component.ts(23,2): error TS2304: Cannot find name 'RouteConfig'.
[0] public/js/acApp/app.component.ts(24,69): error TS2304: Cannot find name 'UserTimelineComponent'.
[0] typings/main/ambient/es6-shim/index.d.ts(11,5): error TS2300: Duplicate identifier 'done'.
[0] typings/main/ambient/es6-shim/index.d.ts(12,5): error TS2300: Duplicate identifier 'value'.
[0] typings/main/ambient/es6-shim/index.d.ts(477,11): error TS2300: Duplicate identifier 'Promise'.
[0] typings/main/ambient/es6-shim/index.d.ts(496,11): error TS2300: Duplicate identifier 'PromiseConstructor'.
[0] typings/main/ambient/es6-shim/index.d.ts(554,13): error TS2300: Duplicate identifier 'Promise'.
[0] typings/main/ambient/es6-shim/index.d.ts(563,5): error TS2300: Duplicate identifier 'size'.
[0] typings/main/ambient/es6-shim/index.d.ts(572,5): error TS2300: Duplicate identifier 'prototype'.
[0] typings/main/ambient/es6-shim/index.d.ts(583,5): error TS2300: Duplicate identifier 'size'.
[0] typings/main/ambient/es6-shim/index.d.ts(592,5): error TS2300: Duplicate identifier 'prototype'.
[0] typings/main/ambient/es6-shim/index.d.ts(607,5): error TS2300: Duplicate identifier 'prototype'.
[0] typings/main/ambient/es6-shim/index.d.ts(621,5): error TS2300: Duplicate identifier 'prototype'.
[0] public/js/acApp/app.component.ts(3,2): error TS2304: Cannot find name 'Component'.
[0] public/js/acApp/app.component.ts(8,2): error TS2304: Cannot find name 'View'.
[0] public/js/acApp/app.component.ts(21,16): error TS2304: Cannot find name 'RouterOutlet'.
[0] public/js/acApp/app.component.ts(23,2): error TS2304: Cannot find name 'RouteConfig'.
[0] public/js/acApp/app.component.ts(24,69): error TS2304: Cannot find name 'UserTimelineComponent'.
-node_modules
-public
--js
---acApp
----main.ts
----app.component.js