問題描述
在使用NPM安裝包的過程中,出現(xiàn)以下錯誤:
npm ERR! code CERT_HAS_EXPIRED
npm ERR! errno CERT_HAS_EXPIRED
npm ERR! request to https://registry.npm.taobao.org/cnpm failed, reason: certificate has expired
原因分析
請求到的 https://registry.npm.taobao.org/cnpm 失敗,原因是證書已經(jīng)過期。
2024年1月22日,淘寶NPM鏡像站的域名 registry.npm.taobao.org 的SSL證書過期。
解決方案
- 清理NPM的緩存
npm cache clean --force
- 切換到新的NPM鏡像站
npm config set registry https://registry.npmmirror.com
- 檢查是否成功切換到新的鏡像站
npm config get registry
如果這個命令返回的是 https://registry.npmmirror.com,那么就說明已經(jīng)成功切換到了新的鏡像站。文章來源:http://www.zghlxwxcb.cn/news/detail-829327.html
參考資料
https://developer.aliyun.com/article/801527
https://juejin.cn/post/7327472360863924224文章來源地址http://www.zghlxwxcb.cn/news/detail-829327.html
到了這里,關(guān)于【Node.js】npm ERR! request to https://registry.npm.taobao.org/cnpm failed ... certificate has expired的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!