NPM 包加速

npm、pnpm、Yarn 安装源加速配置

输入包名生成安装命令,也可以一键生成 npm、pnpm、Yarn 的 registry 配置命令。

配置命令

npm config set registry https://git.hubproxy.top/npm/
pnpm config set registry https://git.hubproxy.top/npm/
yarn config set registry https://git.hubproxy.top/npm/

# .npmrc
registry=https://git.hubproxy.top/npm/

安装命令示例

npm install react --registry=https://git.hubproxy.top/npm/
pnpm add @vue/compiler-sfc --registry=https://git.hubproxy.top/npm/
yarn add lodash@4.17.21 --registry https://git.hubproxy.top/npm/

注意事项

  • 代理官方 registry.npmjs.org 公开包。
  • 不支持私有包和需要登录的 scope。
  • 如果需要恢复官方源,可以重新设置 registry 为 https://registry.npmjs.org/。