有很多方法来配置npm的registry地址,下面根据不同情境列出几种比较常用的方法。以淘宝npm镜像举例:
淘宝 npm 地址: http://npm.taobao.org/

临时使用

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

持久使用

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

配置后使用shell命令验证是否成功
npm config get registry

安装cnpm

1
npm install -g cnpm --registry=https://registry.npm.taobao.org

使用cnpm 安装模块

1
cnpm install hexo

欢迎扫码关注公众号,更好的交流

欢迎扫码关注公众号,更好的交流