2025 npm 国内镜像源/加速列表换源(3月1日更新)

3,051次阅读
没有评论

共计 1183 个字符,预计需要花费 3 分钟才能阅读完成。

国内可用 npm 源镜像

npm 官方原始镜像:https://registry.npmjs.org
淘宝 NPM 镜像:https://registry.npmmirror.com
阿里云 NPM 镜像:https://npm.aliyun.com
腾讯云 NPM 镜像:https://mirrors.cloud.tencent.com/npm
华为云 NPM 镜像:https://mirrors.huaweicloud.com/repository/npm
网易 NPM 镜像:https://mirrors.163.com/npm
中科院大学开源镜像站:http://mirrors.ustc.edu.cn
清华大学开源镜像站:https://mirrors.tuna.tsinghua.edu.cn

使用方法

修改成腾讯云镜像源

1、命令

npm config set registry http://mirrors.cloud.tencent.com/npm/

2. 验证命令

npm config get registry
如果返回 http://mirrors.cloud.tencent.com/npm/,说明镜像配置成功。

修改成淘宝镜像源

1. 命令

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

2. 验证命令

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

修改成华为云镜像源

1. 命令

npm config set registry https://mirrors.huaweicloud.com/repository/npm/

2. 验证命令

npm config get registry
如果返回 https://mirrors.huaweicloud.com/repository/npm/,说明镜像配置成功。

通过使用淘宝定制的 cnpm 安装

1. 安装 cnpm

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

2. 使用 cnpm

cnpm install xxx

淘宝 npm

淘宝 npm 镜像站全新上线:

Web界面地址:https://npmmirror.com

npm 客户端使用地址:https://registry.npmmirror.com


其他进阶操作

使用 nrm 切换镜像源

什么是 nrm?

nrm 是一个 npm 源管理器,允许你快速地在 npm 源间切换。

安装 nrm
npm install -g nrm
使用 nrm

查看可选的源

nrm ls
切换源

如果要切换到 taobao 源,执行命令

nrm use taobao
测试速度
nrm test

恢复官方镜像

如果需要解除镜像并恢复到官方源,请执行以下命令:

npm config set registry https://registry.npmjs.org
正文完
点击链接加入群聊【轩源技术交流群】:https://qm.qq.com/q/xrQ0LCYwTe
post-qrcode
 0
轩源
版权声明:本站原创文章,由 轩源 于2024-09-02发表,共计1183字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
支持作者

☝️用微信请我喝杯咖啡☕️

😛如果文章对您有用,请支持作者😛

支持作者

☝️用支付宝请我喝杯奶茶🧋

评论(没有评论)