卸载全局打字不允许我重新安装

uninstalling global typing not allowing me to reinstall

我已经使用 typings install dt~moment --save --global

安装了 moment global typing

运行 typings list 给我:

├── lodash@4.0.0
├── es6-shim (global)
└── moment (global)

我已经决定使用 typings uninstall moment --global

卸载它

运行 typings list 给我:

├── lodash@4.0.0
└── 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

编辑: 如果你升级到 typescript 2.0,你可以使用 npm 安装 typings。

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

也许这有帮助。