异常现象
根据网上大部分帖子提供更换镜像源方法,将nvm镜像源修改为以下镜像源后,执行 nvm list available
命令查看可用nodejs版本出现以下报错:
node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/
(.venv) PS C:\xxx\> nvm list available
Could not retrieve https://npm.taobao.org/mirrors/node/index.json.
Get "https://npm.taobao.org/mirrors/node/index.json": x509: certificate is valid for *.tbcdn.cn, *.taobao.com, *.alicdn.com, *.cmos.greencompute.org, cmos.greencompute.org, m.intl.taobao.com, *.mobgslb.tbcache.com, *.alikunlun.com, alikunlun.com, *.django.t.taobao.com, alicdn.com, *.tbcache.com, *.tmall.com, *.1688.com, *.3c.tmall.com, *.alibaba.com, *.aliexpress.com, *.aliqin.tmall.com, *.alitrip.com, *.aliyun.com, *.cainiao.com, *.cainiao.com.cn, *.chi.taobao.com, *.chi.tmall.com, *.china.taobao.com, *.dingtalk.com, *.etao.com, *.feizhu.cn, *.feizhu.com, *.fliggy.com, *.fliggy.hk, *.food.tmall.com, *.jia.taobao.com, *.jia.tmall.com, *.ju.taobao.com, *.juhuasuan.com, *.lw.aliimg.com, *.m.1688.com, *.m.alibaba.com, *.m.alitrip.com, *.m.cainiao.com, *.m.etao.com, *.m.taobao.com, *.m.taopiaopiao.com, *.m.tmall.com, *.m.tmall.hk, *.mei.com, *.taopiaopiao.com, *.tmall.hk, *.trip.taobao.com, *.xiami.com, 1688.com, alibaba.com, aliexpress.com, alitrip.com, aliyun.com, cainiao.com, cainiao.com.cn, dingtalk.com, etao.com, feizhu.cn, feizhu.com, fliggy.com, fliggy.hk, juhuasuan.com, mei.com, taobao.com, taopiaopiao.com, tmall.hk, xiami.com, tmall.com, *.cloudvideocdn.taobao.com, cloudvideocdn.taobao.com, tbcdn.cn, not npm.taobao.org
原因分析
淘宝镜像源域名证书于2024年1月到期,导致该地址失效。
解决方案
更换为新可用镜像源地址:
- 找到nvm安装路径(window可执行
where nvm
命令查看); - 打开路径下的
settings.txt
,修改配置参数为下述地址(若不存在下述字段则直接添加进去);
node_mirror: https://npmmirror.com/mirrors/node/
npm_mirror: https://npmmirror.com/mirrors/npm/
参考:https://juejin.cn/post/7329126541321043978