美文网首页
淘宝npm镜像源证书过期处理方法

淘宝npm镜像源证书过期处理方法

作者: 我没叫阿 | 来源:发表于2024-01-22 14:09 被阅读0次

要从淘宝npm镜像源切换回官方npm镜像源,或者更换为其他镜像源,请按照以下步骤进行:

# 切换到官方npm镜像源
npm config set registry https://registry.npmjs.org/

# 验证是否已经切换成功
npm config get registry

# 如果需要全局和局部都切换(确保所有项目使用同一镜像源)
npm config set registry --global https://registry.npmjs.org/

# 如果你之前设置了其他的镜像源,比如你想换成cnpm的镜像源:
npm config set registry https://registry.npmmirror.com/

# 或者你想换成其他国内镜像源,例如中科大镜像:
npm config set registry https://mirrors.ustc.edu.cn/npm/

如果你想临时在单个命令中使用某个镜像源,可以在执行npm命令时直接指定registry参数:

npm --registry=https://registry.npmjs.org/ install some-package

如果你使用的是yarn,则可以这样操作:

# 切换到官方yarn镜像源
yarn config set registry https://registry.yarnpkg.com/

# 或者设置为中国科大的yarn镜像源
yarn config set registry https://mirrors.ustc.edu.cn/yarn/

# 查看当前设置的registry
yarn config get registry

以上就是修改本地npm或yarn镜像源的方法。

相关文章

网友评论

      本文标题:淘宝npm镜像源证书过期处理方法

      本文链接:https://www.haomeiwen.com/subject/bgvyodtx.html