2017-07-07 63 views
0

我剛剛安裝了離子,科爾多瓦,並創建了一個空項目。 每次我啓動離子服務於它顯示與打字稿象這樣的錯誤瀏覽器頁面:離子項目手稿錯誤

**Typescript Error** 

All declarations of 'size' must have identical modifiers. 
node_modules/typescript/lib/lib.es2015.collection.d.ts 
get(key: K): V | undefined; 
has(key: K): boolean; 
set(key: K, value: V): this; 
Typescript Error 
All declarations of 'prototype' must have identical modifiers. 
node_modules/typescript/lib/lib.es2015.collection.d.ts 
new(): WeakMap<object, any>; 
new <K extends object, V>(entries?: [K, V][]): WeakMap<K, V>; 
readonly prototype: WeakMap<object, any>; 

我已經通過互聯網搜索,並沒有發現任何解決方案( 離子信息日誌:

全球包:

@ionic/cli-utils : 1.4.0 
Ionic CLI  : 3.4.0 

本地套餐:

@ionic/app-scripts    : 1.3.12 
@ionic/cli-plugin-ionic-angular : 1.3.1 
Ionic Framework     : ionic-angular 3.5.0 

系統:

Node  : v7.2.0 
OS   : OS X El Capitan 
Xcode  : Xcode 8.2.1 Build version 8C1002 
ios-deploy : not installed 
ios-sim : not installed 
npm  : 4.1.1 
+0

什麼是您的打字稿版本? –

回答

0

不知道這是一個正確的解決方案,我所做的是在tsconfig.json 我設置類型空數組:

"compilerOptions": { 
    "allowSyntheticDefaultImports": true, 
    "declaration": false, 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "lib": [ 
     "dom", 
     "es2015" 
    ], 
    "module": "es2015", 
    "moduleResolution": "node", 
    "sourceMap": true, 
    "target": "es5", 
    "types": [] 

另外這個傢伙建議安裝類型lodash(npm install @ types/lodash --save-dev --save-exact)https://stackoverflow.com/a/44032856/4984738

然後我設置「types」:[「lodash」],這也是有效的。如果有更好的解決方案,請給出任何意見。因爲在我的另一個項目中,它不能解決所有問題,不確定它是一個項目還是由於打字稿造成的問題