2017-06-08 42 views
0

當我使用Visual Studio開發Angular 4應用程序時,我嘗試安裝和卸載一些Angular庫。突然間,我在Visual Studio中發現了以下編譯錯誤:Angular Typescript庫突然無法在Visual Studio中編譯

Severity Code Description Project File Line Suppression State 
Error TS2300 Duplicate identifier 'PropertyKey'. TypeScript Virtual Projects C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TypeScript\lib.es2015.core.d.ts 21 Active 
Error TS2403 Subsequent variable declarations must have the same type. Variable 'prototype' must be of type 'WeakSet<object>', but here has type 'WeakSet<any>'. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 620 Active 
Error TS2403 Subsequent variable declarations must have the same type. Variable 'prototype' must be of type 'WeakSet<object>', but here has type 'WeakSet<any>'. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 620 Active 
Error TS2403 Subsequent variable declarations must have the same type. Variable 'prototype' must be of type 'WeakMap<object, any>', but here has type 'WeakMap<any, any>'. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 606 Active 
Error TS2403 Subsequent variable declarations must have the same type. Variable 'prototype' must be of type 'WeakMap<object, any>', but here has type 'WeakMap<any, any>'. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 606 Active 
Error TS2300 Duplicate identifier 'PropertyKey'. TypeScript Virtual Projects C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TypeScript\lib.es2015.core.d.ts 21 Active 
Error TS2300 Duplicate identifier 'PropertyKey'. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 7 Active 
Error TS2300 Duplicate identifier 'PropertyKey'. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 7 Active 
Error  Build:Subsequent variable declarations must have the same type. Variable 'prototype' must be of type 'WeakSet<object>', but here has type 'WeakSet<any>'. XX XX\node_modules\@types\es6-shim\index.d.ts 620 
Error  Build:Subsequent variable declarations must have the same type. Variable 'prototype' must be of type 'WeakMap<object, any>', but here has type 'WeakMap<any, any>'. XX XX\node_modules\@types\es6-shim\index.d.ts 606 
Error  Build:Duplicate identifier 'PropertyKey'. XX C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.3\lib.es2015.core.d.ts 21 
Error  Build:Duplicate identifier 'PropertyKey'. XX XX\node_modules\@types\es6-shim\index.d.ts 7 
Error  Build:All declarations of 'value' must have identical modifiers. XX XX\node_modules\@types\es6-shim\index.d.ts 11 
Error  Build:All declarations of 'size' must have identical modifiers. XX XX\node_modules\@types\es6-shim\index.d.ts 561 
Error  Build:All declarations of 'size' must have identical modifiers. XX XX\node_modules\@types\es6-shim\index.d.ts 581 
Error  Build:All declarations of 'prototype' must have identical modifiers. XX XX\node_modules\@types\es6-shim\index.d.ts 498 
Error  Build:All declarations of 'prototype' must have identical modifiers. XX XX\node_modules\@types\es6-shim\index.d.ts 570 
Error  Build:All declarations of 'prototype' must have identical modifiers. XX XX\node_modules\@types\es6-shim\index.d.ts 591 
Error  Build:All declarations of 'prototype' must have identical modifiers. XX XX\node_modules\@types\es6-shim\index.d.ts 606 
Error  Build:All declarations of 'prototype' must have identical modifiers. XX XX\node_modules\@types\es6-shim\index.d.ts 620 
Error  Build:All declarations of 'MIN_SAFE_INTEGER' must have identical modifiers. XX XX\node_modules\@types\es6-shim\index.d.ts 290 
Error  Build:All declarations of 'MAX_SAFE_INTEGER' must have identical modifiers. XX XX\node_modules\@types\es6-shim\index.d.ts 283 
Error  Build:All declarations of 'flags' must have identical modifiers. XX XX\node_modules\@types\es6-shim\index.d.ts 346 
Error  Build:All declarations of 'EPSILON' must have identical modifiers. XX XX\node_modules\@types\es6-shim\index.d.ts 248 
Error TS2687 All declarations of 'value' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 11 Active 
Error TS2687 All declarations of 'value' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 11 Active 
Error TS2687 All declarations of 'size' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 561 Active 
Error TS2687 All declarations of 'size' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 561 Active 
Error TS2687 All declarations of 'size' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 581 Active 
Error TS2687 All declarations of 'size' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 581 Active 
Error TS2687 All declarations of 'prototype' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 498 Active 
Error TS2687 All declarations of 'prototype' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 498 Active 
Error TS2687 All declarations of 'prototype' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 570 Active 
Error TS2687 All declarations of 'prototype' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 570 Active 
Error TS2687 All declarations of 'prototype' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 591 Active 
Error TS2687 All declarations of 'prototype' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 591 Active 
Error TS2687 All declarations of 'prototype' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 606 Active 
Error TS2687 All declarations of 'prototype' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 606 Active 
Error TS2687 All declarations of 'prototype' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 620 Active 
Error TS2687 All declarations of 'prototype' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 620 Active 
Error TS2687 All declarations of 'MIN_SAFE_INTEGER' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 290 Active 
Error TS2687 All declarations of 'MIN_SAFE_INTEGER' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 290 Active 
Error TS2687 All declarations of 'MAX_SAFE_INTEGER' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 283 Active 
Error TS2687 All declarations of 'MAX_SAFE_INTEGER' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 283 Active 
Error TS2687 All declarations of 'flags' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 346 Active 
Error TS2687 All declarations of 'flags' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 346 Active 
Error TS2687 All declarations of 'EPSILON' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 248 Active 
Error TS2687 All declarations of 'EPSILON' must have identical modifiers. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts 248 Active 

如何解決這些編譯錯誤?

回答

1

我已經固定這些編譯錯誤刪除從我的Visual Studio項目和故宮包如下

  1. 轉到Web項目文件夾再次重新安裝並刪除「node_modules」文件夾
  2. 打開命令窗口以管理員身份
  3. cd "{project folder path that contains package.json}"
  4. 然後寫npm install
相關問題