切换淘宝最新npm镜像源

👨‍⚕️ 主页: gis分享者

👨‍⚕️ 感谢各位大佬 点赞👍 收藏⭐ 留言📝 加关注✅!

👨‍⚕️ 收录于专栏:前端工程师


文章目录


一、🌎前言

  • NPM(Node Package Manager),是NodeJs的模块依赖管理工具,用于nodejs模块的安装、更新和卸载等。
  • 镜像源是软件包管理工具用来下载和安装软件包的服务器地址。由于网络原因,直接使用官方源可能会导致速度慢或连接失败的问题。国内镜像源可以提供更快的访问速度和更稳定的连接。
  • npm install 安装插件时,从默认npm镜像源获取数据,通常为国外镜像源,这就导致一个问题,访问速度很慢或者干脆超时中断。这时切换到国内npm镜像源,很有必要,国内镜像源有速度快、稳定的特点,本文以切换淘npm镜像源为例介绍如何切换npm镜像源。

二、🌎切换淘宝最新npm镜像源

2.1 🪐查询最新镜像源

通过百度或者官网查询淘宝最新npm镜像源,验证镜像源地址是否过期可用

例如:https://registry.npmmirror.com

提醒已经过期,证明当前镜像源地址不可用

最新淘宝镜像地址:

https://registry.npmmirror.com

返回正确的页面,证明可用

2.2 🪐两种方式切换npm镜像源

2.2.1 💫通过npm配置

查看当前镜像源

yaml 复制代码
npm config get registry

设置淘宝镜像源

yaml 复制代码
npm config set registry https://registry.npmmirror.com/

删除淘宝镜像源

yaml 复制代码
npm config delete registry https://registry.npmmirror.com

查看当前镜像源

yaml 复制代码
npm config get registry

切换到官方npm镜像源

yaml 复制代码
npm config set registry https://registry.npmjs.org/

设置/切换淘宝镜像源

yaml 复制代码
npm config set registry https://registry.npmmirror.com/

删除淘宝镜像源

yaml 复制代码
npm config delete registry https://registry.npmmirror.com/

2.2.1 💫通过cnpm配置

通过cnpm使用淘宝镜像:

yaml 复制代码
npm install -g cnpm --registry=https://registry.npmmirror.com

将npm设置为淘宝镜像:

yaml 复制代码
npm config set registry https://registry.npmmirror.com

查看npm镜像设置:

yaml 复制代码
npm config get registry 

查看cnpm镜像设置:

yaml 复制代码
cnpm config get registry 

cnpm安装插件:

yaml 复制代码
cnpm install xxx

三、🌎总结

以上为切换切换淘宝最新npm镜像源的方法,其他国内npm镜像源切换方法同理,希望对您有帮助~

相关推荐
sanzk1 天前
Node.js | pnpm下载安装与环境配置
npm
爱宇阳1 天前
npm 常用标签与使用技巧新手教程
前端·npm·node.js
郑板桥301 天前
TypeScript:npm的types、typings、@type的区别
javascript·typescript·npm
@大迁世界1 天前
2025 年该选谁?npm vs yarn vs pnpm
前端·npm·node.js
crary,记忆1 天前
简介NPM 和 NPX
前端·学习·npm·node.js
前端架构师-老李2 天前
npm、yarn、pnpm的对比和优略
前端·npm·node.js·pnpm·yarn
勉灬之2 天前
通过npm run XXX命令生成uniapp的pages.json文件
npm·uni-app·json
duandashuaige5 天前
解决用electron打包Vue工程(Vite)报错electron : Failed to load URL : xxx... with error : ERR _CONNECTION_REFUSED
javascript·typescript·electron·npm·vue·html
weixin_405023376 天前
包资源管理器NPM 使用
前端·npm·node.js
小于小于09126 天前
npx 与 npm 区别
前端·npm·node.js