Skip to content

文章目录

NPM

  1. 查看源
shell
    npm get registry
  1. 临时修改
shell
    npm --registry https://registry.npmmirror.com install axios
  1. 持久使用
shell
    npm config set registry https://registry.npmmirror.com
  1. 还原
shell
    npm config set registry https://registry.npmjs.org

YARN

  1. 查看源
shell
    yarn config get registry
  1. 临时修改
shell
    yarn add axios --registry=https://registry.npmjs.org/
  1. 持久使用
shell
    yarn config set registry https://registry.npmmirror.com/

PNPM

  1. 查看源
shell
    pnpm get registry
  1. 临时修改
shell
    pnpm --registry https://registry.npmmirror.com install axios
  1. 持久使用
shell
    pnpm config set registry https://registry.npmmirror.com
  1. 还原
shell
    pnpm config set registry https://registry.npmjs.org

一些问题说明: 在配置阿里镜像源之后,可能有一些包的某个版本在安装的过程提示不存在,但是到 https://www.npmjs.com/ npm 官网查询又发现可能是存在的。出现这个问题可能就是因为这个包 阿里镜像源没有同步过来,这个时候就可以到 npmmirror 镜像站 这个镜像站手动同步一下