【问题标题】:VS2015 build fail "Duplicate identifier" Angular 2VS2015构建失败“重复标识符”Angular 2
【发布时间】:2017-11-07 17:34:58
【问题描述】:

安装和卸载 angular-cli 后,我的构建失败并出现此错误:

1>...\node_modules\@types\jasmine\index.d.ts(9,18): error TS2300: Build:Duplicate identifier 'describe'. 1>...\node_modules\@types\jasmine\index.d.ts(11,18): error TS2300: Build:Duplicate identifier 'xdescribe'. 1>...\node_modules\@types\jasmine\index.d.ts(13,18): error TS2300: Build:Duplicate identifier 'it'. 1>...\node_modules\@types\jasmine\index.d.ts(15,18): error TS2300: Build:Duplicate identifier 'xit'. 1>...\node_modules\@types\mocha\index.d.ts(33,13): error TS2300: Build:Duplicate identifier 'describe'. 1>...\node_modules\@types\mocha\index.d.ts(34,13): error TS2300: Build:Duplicate identifier 'xdescribe'. 1>...\node_modules\@types\mocha\index.d.ts(39,13): error TS2300: Build:Duplicate identifier 'it'. 1>...\node_modules\@types\mocha\index.d.ts(40,13): error TS2300: Build:Duplicate identifier 'xit'.

目前解决方案非常混乱,而且我是 Angular 2/TypeScript 的新手,因此很难调试。我尝试了这个解决方案Typescript, confusing "duplicate identifier" error message,但它对我不起作用。

tsconfig.json:

{
  "compilerOptions": {
    "baseUrl": "./",
    "paths": {
      "*": [ "./node_modules/@types/*", "*" ]
     },
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "types": [ ],
     "noImplicitAny": false
  },
  "exclude": [
    "node_modules",
    "/node_modules",
    "../node_modules",
    "*node_modules*",
    "/node_modules*",
    "angular2",
    "rxjs",
    "typings"
  ]
}

【问题讨论】:

标签: visual-studio angular typescript typescript-typings


【解决方案1】:

看起来像.d.ts 定义冲突。您是否同时使用JasmineMocha?如果没有,请删除您不使用的那个,然后删除您的 node_modules 文件夹并再次运行 npm install

【讨论】:

  • 如果你同时使用 Jasmine 和 Mocha 怎么办?
猜你喜欢
  • 2017-11-15
  • 2020-06-20
  • 2016-06-22
  • 2016-07-24
  • 2020-06-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多