惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

人人都是产品经理
人人都是产品经理
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
月光博客
月光博客
雷峰网
雷峰网
Google DeepMind News
Google DeepMind News
Y
Y Combinator Blog
Microsoft Security Blog
Microsoft Security Blog
M
MIT News - Artificial intelligence
WordPress大学
WordPress大学
MongoDB | Blog
MongoDB | Blog
V
V2EX
博客园 - 【当耐特】
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
I
InfoQ
Martin Fowler
Martin Fowler
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Hugging Face - Blog
Hugging Face - Blog
B
Blog
V
Visual Studio Blog
D
DataBreaches.Net
C
Check Point Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
F
Fortinet All Blogs

博客园 - coffee~

在微信端使用Openclaw的简单配置方法--WorkBuddy 使用Termux+Proot-distro+Ubuntu+zsh在手机端配置安装Openclaw,使用Skillhub安装skill, 接入企业微信 一加13刷氧系统--OxygenOS 15 for oneplus 13 Playwright使用Typescript实现在测试case文件中调用另一个文件中的方法 Cypress实现拖拽 git基本命令 使用Playwright进行Web页面UI自动化测试 Python获取星期几 cd命令切换目录简写 win10在任意位置安装Linux子系统WSL Ubuntu pixel刷机没有退出谷歌账号,无法跳过开机验证 Python在一个文件中引用另一个文件的所有变量 pycharm给代码批量添加tab/取消添加tab 用Pycharm把浏览器复制出来的headers/参数给字段和值分别加单引号 Python requests.get所有参数顺序、Python requests.post所有参数顺序 windows使用快捷按键进行截图、录屏 3个瓶盖可以兑换一瓶饮料,买了n瓶饮料,一共可以喝到多少瓶 Python由字符串生成字典 Python生成随机数 Python安装包国内镜像源 QQ飞车手游UI自动化测试尝试
npm切换下载源为国内的镜像源
coffee~ · 2026-03-09 · via 博客园 - coffee~

npm在国内存在下载速度比较慢的问题。为解决这个问题,需要切换npm下载源为国内的镜像源

npm国内下载镜像汇总:

npm官方原始镜像: https://registry.npmjs.org/

淘宝npm镜像:http://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/

查看当前使用的npm镜像源,使用命令:

npm config get registry

切换npm镜像源,使用命令:

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

切换为国内的镜像源之后,确认是否切换成功,查看当前使用的npm镜像,命令

npm config get registry 

使用nrm管理镜像源

nrm是一个npm源管理工具,可以使用nrm切换不同的镜像源

先恢复官方的镜像源,使用命令

npm config set registry https://registry.npmjs.org/

安装nrm,命令:

npm install -g nrm

使用nrm查看有哪些npm镜像源, 命令:

nrm ls

运行命令,会得到类似以下结果的输出

npm ---- https://registry.npmjs.org/

yarn ---- https://registry.yarnpkg.com/

tencent - https://mirrors.cloud.tencent.com/npm/

taobao-- https://registry.npmmirror.com/

huawei -- https://repo.huaweicloud.com/repository/npm/

5b70b661114c6f65cfe8526a5b8545ae

使用nrm切换npm镜像源,需要用到nrm ls命令中得到的结果,命令如下:

nrm taobao

恢复官方源,运行命令:

npm config set registry https://registry.npmjs.org/