本文介绍了TS2300:移动到Angular2 RC2时出现重复标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,当从Angular2 RC1迁移到RC2时,我将package.json文件更改为包含更新的'快速启动'package.json示例-使我的package.json文件的依存关系部分如下所示:

So, when moving from Angular2 RC1 to RC2 I changed my package.json file to include all the dependencies shown in the updated 'quickstart' package.json example -- making my dependencies section of my package.json file look like this:

  "dependencies": {
      "@angular/common":  "2.0.0-rc.2",
      "@angular/compiler":  "2.0.0-rc.2",
      "@angular/core":  "2.0.0-rc.2",
      "@angular/http":  "2.0.0-rc.2",
      "@angular/platform-browser":  "2.0.0-rc.2",
      "@angular/platform-browser-dynamic":  "2.0.0-rc.2",
      "@angular/router":  "2.0.0-rc.2",
      "@angular/router-deprecated":  "2.0.0-rc.2",
      "@angular/upgrade":  "2.0.0-rc.2",
    "core-js": "^2.4.0",
    "bootstrap": "^3.3.6",
    "es6-shim": "^0.35.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "systemjs": "0.19.27",
    "zone.js": "^0.6.12"   },

然后我跑npm install给我新的感觉.

I then ran npm install to get me the new hotness.

这返回了无数错误,但是焊接后我最终得到了似乎可以工作的东西.

This returned myriad errors, but soldering on I eventually got something that seemed like it might work.

当我去跑步我的npm start时,我受到了这样的问候:

When I went to run my npm start I was greeted with this:

与打字有关的大量错误以及各种位置的TS:2300重复标识符错误.

A whole host of errors relating to typings and TS:2300 duplicate identifiers errors for all sorts of locations.

推荐答案

进一步查看 quickstart 更改package.json文件并运行npm install后的下一步是警告可能无法正确创建类型文件夹.

Looking further at the quickstart the next step after changing the package.json file and running npm install is a warning that the typings folder might not be created correctly.

它指示用户手动运行npm run typings install.

执行此操作后,错误TS2300:重复的标识符问题没有消失.

After doing this, the error TS2300: Duplicate identifier issues did not go away.

因此,我删除了typesings文件夹并重新运行该命令以从头开始创建整个文件夹(请注意,新的RC2版本似乎与RC1版本具有不同的布局).

So I deleted the typings folder and re-ran the command to recreate the entire folder from scratch (noting that the new RC2 version seesm to have a different layout than the RC1 version).

完成此操作后,精简服务器和复杂功能正常运行,并且TS2300错误没有再次抬起头来.

After doing this, the lite-server and complication worked and the TS2300 error didn't rear it's head again.

(我仍然无法使RC2正常工作……但这与该问题无关)

(I'm still having trouble getting RC2 to work... but that's irrelevant to this question)

这篇关于TS2300:移动到Angular2 RC2时出现重复标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 05:12