npm使用淘宝镜像源
单次使用

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

使用

npm install koa

全局配置淘宝镜像源

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

查看配置是否成功

npm config get registry

需要换回时改为官方的镜像源

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

参考:https://www.cnblogs.com/tanyiqu/p/14532462.html
https://www.jianshu.com/p/c35e832a08d8

命令汇总

  • 单次使用:npm install koa --registry=https://registry.npmmirror.com
  • 全局设置:npm config set registry https://registry.npmmirror.com
  • 查看当前源:npm config get registry
  • 恢复官方源:npm config set registry https://registry.npmjs.org

提示:淘宝 npm 镜像已更名为 npmmirror,旧的 registry.npm.taobao.org 已停止服务,建议改用新域名;yarn 可用 yarn config set registry 设置。

相关阅读

参考资料