0

按照本教程,我创建了一个工作应用程序,但在我更新到 Visual Studio 的 Cordova Tools 6 后,我无法再编译,因为有很多重复的标识符。如果我以 ES5 而不是 ES6 为目标,它可以工作。我正在使用离子 CLI 到 2.0.0-beta.17。

我的package.json

{
  "dependencies": {
    "angular2": "2.0.0-beta.2",
    "es6-promise": "3.0.2",
    "es6-shim": "0.33.13",
    "ionic-framework": "2.0.0-alpha.57",
    "ionicons": "3.0.0-alpha.3",
    "reflect-metadata": "0.1.2",
    "rxjs": "5.0.0-beta.0",
    "zone.js": "0.5.10"
  },
  "devDependencies": {
    "awesome-typescript-loader": "0.15.10",
    "strip-sourcemap-loader": "0.0.1",
    "typescript": "1.7.5"
  },
  "name": "firstaid",
  "description": "FirstAid: An Ionic project",
  "cordovaPlugins": [],
  "cordovaPlatforms": [
    {
      "platform": "android",
      "locator": "windows"
    }
  ]
}

我的编译输出:

------ Build started: Project: FirstAid, Configuration: Debug Android ------
Build started 16-Feb-16 17:50:33.
     1>
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(3841,14): error TS2300: Build: Duplicate identifier 'PropertyKey'.
     1>
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4061,5): error TS2300: Build: Duplicate identifier 'EPSILON'.
     1>
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4096,5): error TS2300: Build: Duplicate identifier 'MAX_SAFE_INTEGER'.
     1>
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4103,5): error TS2300: Build: Duplicate identifier 'MIN_SAFE_INTEGER'.
     1>
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4389,5): error TS2300: Build: Duplicate identifier 'done'.
     1>
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4390,5): error TS2300: Build: Duplicate identifier 'value'.
     1>
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4619,5): error TS2300: Build: Duplicate identifier 'flags'.
     1>
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4647,5): error TS2300: Build: Duplicate identifier 'size'.
     1>
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4657,5): error TS2300: Build: Duplicate identifier 'prototype'.
     1>
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4674,5): error TS2300: Build: Duplicate identifier 'prototype'.
     1>
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4686,5): error TS2300: Build: Duplicate identifier 'size'.
     1>
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4696,5): error TS2300: Build: Duplicate identifier 'prototype'.
     1>
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4712,5): error TS2300: Build: Duplicate identifier 'prototype'.
     1>
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(5099,5): error TS2300: Build: Duplicate identifier 'prototype'.
     1>
C:\app\a\FirstAid\FirstAid\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(6,14): error TS2300: Build: Duplicate identifier 'PropertyKey'.
     1>
C:\app\a\FirstAid\FirstAid\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(9,5): error TS2300: Build: Duplicate identifier 'done'.
     1>
C:\app\a\FirstAid\FirstAid\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(10,5): error TS2300: Build: Duplicate identifier 'value'.
     1>
C:\app\a\FirstAid\FirstAid\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(248,5): error TS2300: Build: Duplicate identifier 'EPSILON'.
     1>
C:\app\a\FirstAid\FirstAid\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(283,5): error TS2300: Build: Duplicate identifier 'MAX_SAFE_INTEGER'.
     1>
C:\app\a\FirstAid\FirstAid\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(290,5): error TS2300: Build: Duplicate identifier 'MIN_SAFE_INTEGER'.
     1>
C:\app\a\FirstAid\FirstAid\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(346,5): error TS2300: Build: Duplicate identifier 'flags'.
     1>
C:\app\a\FirstAid\FirstAid\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(498,5): error TS2300: Build: Duplicate identifier 'prototype'.
     1>
C:\app\a\FirstAid\FirstAid\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(561,5): error TS2300: Build: Duplicate identifier 'size'.
     1>
C:\app\a\FirstAid\FirstAid\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(570,5): error TS2300: Build: Duplicate identifier 'prototype'.
     1>
C:\app\a\FirstAid\FirstAid\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(581,5): error TS2300: Build: Duplicate identifier 'size'.
     1>
C:\app\a\FirstAid\FirstAid\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(590,5): error TS2300: Build: Duplicate identifier 'prototype'.
     1>
C:\app\a\FirstAid\FirstAid\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(605,5): error TS2300: Build: Duplicate identifier 'prototype'.
     1>
C:\app\a\FirstAid\FirstAid\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(619,5): error TS2300: Build: Duplicate identifier 'prototype'.

Build FAILED.

Time Elapsed 00:00:01.24
======== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

我的tsconfig.json

{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "noEmitOnError": false,
    "rootDir": ".",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "sourceMap": false,
    "inlineSourceMap": false,
    "inlineSources": false
  },
  "files": [
    "app/app.ts"
  ],
  "exclude": [
        "node_modules"
  ],
  "compileOnSave": false
}
4

1 回答 1

0

如果这是与此处相同的问题:Typescript,混淆“重复标识符”错误消息

那么你的问题是双重的。1)您的 tsconfig.json 中存在问题,例如缺少文件部分(您可以使用 tsconfig 文件更新您的问题吗?) 2)Typescript 安装了两次,全局和本地,因此 TS 位于本地 node_modules 文件夹中项目的根目录。

于 2016-02-17T21:51:03.703 回答