npm开始使用Angular 2 RC版本时出错

时间:2016-08-02 02:16:54

标签: angular npm typescript-typings

我将Angular2 beta 15版本更改为RC版本,运行应用程序时出现了一些错误。

typings/browser/ambient/es6-shim/index.d.ts(8,14): error TS2300: Duplicate identifier 'PropertyKey'.
typings/browser/ambient/es6-shim/index.d.ts(11,5): error TS2300: Duplicate identifier 'done'.
typings/browser/ambient/es6-shim/index.d.ts(12,5): error TS2300: Duplicate identifier 'value'.
typings/browser/ambient/es6-shim/index.d.ts(250,5): error TS2300: Duplicate identifier 'EPSILON'.
typings/browser/ambient/es6-shim/index.d.ts(285,5): error TS2300: Duplicate identifier 'MAX_SAFE_INTEGER'.
typings/browser/ambient/es6-shim/index.d.ts(292,5): error TS2300: Duplicate identifier 'MIN_SAFE_INTEGER'.
typings/browser/ambient/es6-shim/index.d.ts(348,5): error TS2300: Duplicate identifier 'flags'.
typings/browser/ambient/es6-shim/index.d.ts(500,5): error TS2300: Duplicate identifier 'prototype'.
typings/browser/ambient/es6-shim/index.d.ts(563,5): error TS2300: Duplicate identifier 'size'.
typings/browser/ambient/es6-shim/index.d.ts(572,5): error TS2300: Duplicate identifier 'prototype'.
typings/browser/ambient/es6-shim/index.d.ts(583,5): error TS2300: Duplicate identifier 'size'.
typings/browser/ambient/es6-shim/index.d.ts(592,5): error TS2300: Duplicate identifier 'prototype'.
typings/browser/ambient/es6-shim/index.d.ts(607,5): error TS2300: Duplicate identifier 'prototype'.
typings/browser/ambient/es6-shim/index.d.ts(621,5): error TS2300: Duplicate identifier 'prototype'.
typings/globals/core-js/index.d.ts(3,14): error TS2300: Duplicate identifier 'PropertyKey'.
typings/globals/core-js/index.d.ts(217,5): error TS2300: Duplicate identifier 'flags'.
typings/globals/core-js/index.d.ts(231,5): error TS2300: Duplicate identifier 'EPSILON'.
typings/globals/core-js/index.d.ts(266,5): error TS2300: Duplicate identifier 'MAX_SAFE_INTEGER'.
typings/globals/core-js/index.d.ts(273,5): error TS2300: Duplicate identifier 'MIN_SAFE_INTEGER'.
typings/globals/core-js/index.d.ts(583,5): error TS2300: Duplicate identifier 'size'.
typings/globals/core-js/index.d.ts(589,5): error TS2300: Duplicate identifier 'prototype'.
typings/globals/core-js/index.d.ts(600,5): error TS2300: Duplicate identifier 'size'.
typings/globals/core-js/index.d.ts(606,5): error TS2300: Duplicate identifier 'prototype'.
typings/globals/core-js/index.d.ts(621,5): error TS2300: Duplicate identifier 'prototype'.
typings/globals/core-js/index.d.ts(635,5): error TS2300: Duplicate identifier 'prototype'.
typings/globals/core-js/index.d.ts(646,5): error TS2300: Duplicate identifier 'done'.
typings/globals/core-js/index.d.ts(647,5): error TS2300: Duplicate identifier 'value'.
typings/globals/core-js/index.d.ts(759,5): error TS2300: Duplicate identifier 'prototype'.

你能帮我找到解决这个问题的方法吗?我是Angular2中的菜鸟。

我的json文件typings.json如下所示:

{
    "ambientDependencies": {
        "es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#7de6c3dd94feaeb21f20054b9f30d5dabc5efabd"
    }
}

2 个答案:

答案 0 :(得分:1)

您的typings.json文件使用了弃用的语法:它使用的是ambientDependencies而不是globalDependencies。此外,Angular RC不再使用es6-shim

删除您的打字文件夹,更新您的typings.json文件并重新安装。

按以下方式更新typings.json

{
  "globalDependencies": {
    "core-js": "registry:dt/core-js#0.0.0+20160602141332",
    "jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
    "node": "registry:dt/node#6.0.0+20160621231320"
  }
}

答案 1 :(得分:0)

在typings.json中重命名:

ambientDevDependencies to globalDevDependencies

ambientDependencies to globalDependencies

然后,在控制台:

$ typings install

├──es6-shim(全球)

├──角度量角器(全球开发者)

├──茉莉(全球开发)

└──selenium-webdriver(全球开发)