2016-11-05 67 views
0

我下載了angular.io「英雄之旅」的最終plunk,但我遇到了錯誤。我使用第一個plunk中的package.json文件,因爲最終的plunk中沒有提供package.json文件。 npm start會返回下面的錯誤。這是今天晚上的新鮮事。我搜索了一些這些錯誤,並看到了一些我嘗試過的建議,但錯誤仍然存​​在。任何想法如何解決?當我嘗試運行angular.io「英雄之旅」時遇到錯誤最終plunk

app/app.component.ts(4,13): error TS2304: Cannot find name 'module'. 
app/dashboard.component.ts(8,13): error TS2304: Cannot find name 'module'. 
app/hero-detail.component.ts(9,13): error TS2304: Cannot find name 'module'. 
app/hero-search.component.ts(10,13): error TS2304: Cannot find name 'module'. 
app/heroes.component.ts(8,13): error TS2304: Cannot find name 'module'. 
node_modules/@types/core-js/index.d.ts(21,14): error TS2300: Duplicate identifier 'PropertyKey'. 
node_modules/@types/core-js/index.d.ts(85,5): error TS2687: All declarations of 'name' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(145,5): error TS2403: Subsequent variable declarations must have the same type. Variable '[Symbol.unscopables]' must be of type '{ copyWithin: boolean; entries: boolean; fill: boolean; find: boolean; findIndex: boolean; keys: ...', but here has type 'any'. 
node_modules/@types/core-js/index.d.ts(262,5): error TS2687: All declarations of 'flags' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(276,5): error TS2687: All declarations of 'EPSILON' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(311,5): error TS2687: All declarations of 'MAX_SAFE_INTEGER' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(318,5): error TS2687: All declarations of 'MIN_SAFE_INTEGER' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(457,5): error TS2403: Subsequent variable declarations must have the same type. Variable '[Symbol.toStringTag]' must be of type '"Symbol"', but here has type 'string'. 
node_modules/@types/core-js/index.d.ts(457,5): error TS2687: All declarations of '[Symbol.toStringTag]' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(464,5): error TS2687: All declarations of 'prototype' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(492,5): error TS2687: All declarations of 'hasInstance' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(498,5): error TS2687: All declarations of 'isConcatSpreadable' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(504,5): error TS2687: All declarations of 'iterator' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(510,5): error TS2687: All declarations of 'match' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(516,5): error TS2687: All declarations of 'replace' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(522,5): error TS2687: All declarations of 'search' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(528,5): error TS2687: All declarations of 'species' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(534,5): error TS2687: All declarations of 'split' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(540,5): error TS2687: All declarations of 'toPrimitive' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(546,5): error TS2687: All declarations of 'toStringTag' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(552,5): error TS2687: All declarations of 'unscopables' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(609,5): error TS2403: Subsequent variable declarations must have the same type. Variable '[Symbol.toStringTag]' must be of type '"Math"', but here has type 'string'. 
node_modules/@types/core-js/index.d.ts(609,5): error TS2687: All declarations of '[Symbol.toStringTag]' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(613,5): error TS2403: Subsequent variable declarations must have the same type. Variable '[Symbol.toStringTag]' must be of type '"JSON"', but here has type 'string'. 
node_modules/@types/core-js/index.d.ts(613,5): error TS2687: All declarations of '[Symbol.toStringTag]' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(628,5): error TS2687: All declarations of 'size' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(634,5): error TS2687: All declarations of 'prototype' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(645,5): error TS2687: All declarations of 'size' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(651,5): error TS2687: All declarations of 'prototype' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(666,5): error TS2687: All declarations of 'prototype' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(680,5): error TS2687: All declarations of 'prototype' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(692,5): error TS2687: All declarations of 'value' must have identical modifiers. 
node_modules/@types/core-js/index.d.ts(804,5): error TS2687: All declarations of 'prototype' must have identical modifiers. 
node_modules/typescript/lib/lib.es6.d.ts(4133,14): error TS2300: Duplicate identifier 'PropertyKey'. 

回答

1

在你tsconfig.json你需要添加

"exclude": [ 
    "node_modules", 
    "typings" 
] 

,所以它不會嘗試編譯node_modules和分型的文件夾。

+1

對我不起作用,沒有任何變化 – iJungleBoy

+0

@iJungleBoy你能給出更多的細節,哪些不起作用,錯誤是什麼? – taropoo

+0

我必須再看一遍。從我記得它有點來回,我相信它就像「如果你嘗試AoT,它失敗了,找到堆棧溢出的解決方案,應用它,然後你會得到非AoT中的所有錯誤「 或者其他的東西。但我再也看不到這個星期左右。 thx爲快速回復 – iJungleBoy

1
  1. 刪除@類型/芯-JS通過運行下面的命令: 「NPM卸載@類型/芯-JS」

  2. 然後安裝芯-JS通過運行下面的命令: 「NPM安裝核心JS --save」

0

刪除%LOCALAPPDATA%\微軟\打字稿,然後運行:NPM安裝-g [email protected]

相關問題