快乐随行

导航

淘宝 NPM 镜像站切换新域名

1. 新域名

用CNPM/淘宝源的开发者们请注意:淘宝NPM 镜像站喊你切换新域名啦。

Web 站点:https://npmmirror.com

Registry Endpoint:https://registry.npmmirror.com

随着新的域名已经正式启用,老 http://npm.taobao.orghttp://registry.npm.taobao.org 域名将于 2022 年 05 月 31 日零时起停止服务

2. 可能受到的影响和处理方式:

  • 企业用户需要联系 网管/IT/SRE 更新防火墙白名单。
  • cnpm 自身的 CLI,我们会对每个大版本都发个 patch 去更新,开发者重新安装即可。
  • nrm 等工具,需要提 PR 去更新内置的域名。
  • 一些开发者自己封装的工具,如 egg-init,需要维护者自行提 PR 去更新。
  • 存量应用的 lock 文件,开发者需要自行执行 sed 等指令去替换或重新生成。
  • 本地 npmrc 里面的 registry 地址,(如果有,则)需要开发者自行更新。
  • 平台应用里面写死的,需开发者自己更新并部署。

3. npm 切换镜像站点

3.1 切换淘宝镜像

npm config set registry https://registry.npmmirror.com/

验证命令:

npm config get registry

如果返回https://registry.npmmirror.com,说明镜像配置成功。

3.2 切换为官方源

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

3.2 cnpm安装

npm install -g cnpm --registry=https://registry.npmmirror.com

使用cnpm:

cnpm install xxx

参考:

阿里技术 https://zhuanlan.zhihu.com/p/432578145

posted on 2021-11-26 10:59  快乐随行  阅读(2145)  评论(0编辑  收藏  举报