我已经安装了片刻全球打字使用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
我不想全球安装,即时尝试全球卸载并安装在本地 – shenku
我不认为你可以。我可能是错的,但它似乎只能作为全球安装。找到何时安装全局或本地的定义:“如果模块定义在顶层具有导入或导出声明,则将其视为”外部“,其他所有内容均可视为”全局“。 目前似乎缺乏顶级的进口和进口,所以我认为它只能在全球范围内安装。 来源:https://github.com/typings/typings/blob/master/docs/faq.md(类型的类型) – m4ttsson
如果你升级到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