2016-09-26 70 views
1

我已經安裝了片刻全球打字使用typings install dt~moment --save --global卸載全球打字不是讓我重新安裝

運行typings list給我:

├── [email protected] 
├── es6-shim (global) 
└── moment (global) 

因爲我已經決定使用typings uninstall moment --global

運行卸載它typings list給我:

├── [email protected] 
└── es6-shim (global) 

現在我去使用typings install dt~moment --save在當前目錄下安裝並收到以下錯誤:

typings ERR! message Attempted to compile "moment" as an external module, but it looks like a global module. You'll need to enable the global option to continue.

爲什麼地球上是發生的事情,我也試圖清除緩存之前它並沒有幫助。

node v5 
npm v3.3.9 
tsc v1.8.10 

回答

2

編輯: 如果您升級到2.0打字原稿,你可以與故宮安裝分型。

npm install @types/moment 

https://blogs.msdn.microsoft.com/typescript/2016/06/15/the-future-of-declaration-files/https://www.npmjs.com/package/@types/moment

也許沒有什麼幫助。

+0

我不想全球安裝,即時嘗試全球卸載並安裝在本地 – shenku

+2

我不認爲你可以。我可能是錯的,但它似乎只能作爲全球安裝。找到何時安裝全局或本地的定義:「如果模塊定義在頂層具有導入或導出聲明,則將其視爲」外部「,其他所有內容均可視爲」全局「。 目前似乎缺乏頂級的進口和進口,所以我認爲它只能在全球範圍內安裝。 來源:https://github.com/typings/typings/blob/master/docs/faq.md(類型的類型) – m4ttsson

+2

如果你升級到typescript 2.0,你可以使用npm安裝類型。 https://blogs.msdn.microsoft.com/typescript/2016/06/15/the-future-of-declaration-files/ https://www.npmjs.com/package/@types/moment 也許這有助於更多。 – m4ttsson

相關問題