我已经安装了使用typings install dt~moment --save --global
正在运行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
答案 0 :(得分:2)
编辑: 如果你升级到typescript 2.0,你可以用npm安装打字。
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
也许这有帮助。