安装下划线打字时出错

Error while installing Underscore typings

我正在尝试安装 Underscore typings 但出现错误

Unable to find "underscore" ("npm") in the registry. Did you want to try searching another source? Also, if you want contribute these typings, please help us: https://github.com/typings/registry

我根据我的研究和其他人提供的解决方案尝试了不同的开关,如图所示。

如果我做错了什么,请告诉我。

下面的命令对我有用,

typings install dt~underscore --global --save

参考 - GitHub Link

核心问题是我 Mac 的权限问题。您的用户帐户需要拥有您的 npm 安装目录.

然后你可以运行命令:

typings install dt~underscore --global --save

您应该不会再看到任何错误。

这是截至 2017 年 4 月的最新数据

npm install --save @types/underscore