基于众所周知的原因,在国内使用npm下载资源的时候非常缓慢,甚至失败。使用一个靠谱的国内代理镜像是较好地解决方案。
- 命令行临时指定
可以临时指定npm镜像
1 | npm --registry https://registry.npm.taobao.org info underscore |
- 通过config配置
1 | npm config set registry https://registry.npm.taobao.org |
- 编辑配置文件
~/.npmrc
1 | registry = https://registry.npm.taobao.org |
