For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /record/tooling/registry-mirror.md.

包管理工具换源

Yarn 和 NPM(npx) 是主流的资源包管理工具,默认安装使用时,下载资源的速度非常慢。其主要原因是 npm 资源包默认的服务器在国外,当使用 yarn 和 npm 安装资源包时候,速度非常慢。为了解决下载速度的问题,大多使用阿里的 淘宝镜像(cnpm)来解决下载速度慢安装失等问题。

安装淘宝镜像

淘宝镜像地址
npm install -g cnpm --registry=https://registry.npmmirror.com
  • 安装模块
安装模块
cnpm install [name]
  • 移除模块
移除模块
cnpm uninstall [name]

查看源/切换源

  • 查看源
查看源地址
yarn config get registry
// yarn 当前(默认)镜像源:https://registry.yarnpkg.com/

npm config get registry
// npm 当前(默认)镜像源:https://registry.npmjs.org/
  • 设置源
设置源地址
yarn config set registry https://registry.npmmirror.com
// yarn、npm 切换淘宝镜像源
npm config set registry https://registry.npmmirror.com
提示

「点击 🫱 查看 👀」Yarn 中文文档 :

查看 npm 安装的插件

查看全局安装的包
// npm 查看全局安装的包
npm list -g --depth -0

// yarn 查看全局安装的包
yarn global list

清除缓存

清除缓存
// npm 清除缓存
npm cache clean -f

// yarn 清除缓存
yarn cache clean

镜像配置参考

温馨提示

淘宝镜像旧源地址http://npm.taobao.org 和 http://registry.npm.taobao.org 于 2022.06.30 号正式下线和停止 DNS 解析。现在启用的镜像地址为:https://registry.npmmirror.com