npm 仓库配置

202 阅读1分钟

国外官方的npm仓库下载速度很慢的话,可以考虑更换npm仓库,加快下载包的速度。

1.通过config命令

npm config set registry https://registry.npm.taobao.org 

npm config list #查看npm当前配置

2.命令行指定 每次执行命令前加入–registry指定仓库路径

npm --registry https://registry.npm.taobao.org install

3.编辑 ~/.npmrc 加入下面内容

registry = https://registry.npm.taobao.org