2017-06-06 66 views
1

我安裝和卸載角CLI後,我的版本是得到這個錯誤:VS2015構建失敗「重複標識符」角2

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" 
    ] 
} 
+0

可能重複[打字稿,混淆「重複標識符」錯誤消息](https://stackoverflow.com/questions/31322525/typescript-confusing-duplicate-identifier-error-message) – JSess

回答

1

貌似.d.ts定義碰撞。您是否同時使用JasmineMocha?如果不是,請刪除您不使用的那個,然後刪除node_modules文件夾並再次運行npm install

+1

如果你使用兩個茉莉花和摩卡? –