npm修改镜像源


​ 测试机安装一个插件npm报错:

npm install hexo-lazyload-image –save

npm ERR! code CERT_HAS_EXPIRED

npm ERR! errno CERT_HAS_EXPIRED

npm ERR! request to https://registry.npm.taobao.org/hexo-lazyload-image failed, reason: certificate has expired

记得以前改过国内淘宝镜像点,网上查询到url地址已经切换为https://registry.npmmirror.com,修改一下config应该可以了。

查看当前npm设置:

npm config list

; “user” config from /root/.npmrc

registry = “https://registry.npm.taobao.org/

; node bin location = /root/.nvm/versions/node/v16.20.2/bin/node

清空缓存:

npm cache clean –force

npm WARN using –force Recommended protections disabled.

设置新的镜像url:

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

确认一下config:

npm config list

; “user” config from /root/.npmrc

registry = “https://registry.npmmirror.com/

再重新安装:

npm install hexo-lazyload-image –save

added 2 packages in 3s

32 packages are looking for funding

run npm fund for details

npm notice

npm notice New major version of npm available! 8.19.4 -> 10.5.1

npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.5.1

npm notice Run npm install -g npm@10.5.1 to update!

npm notice


文章作者: 云上的小雨滴
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 云上的小雨滴 !
评论
  目录