报错内容与分析
ERR_PNPM_BROKEN_METADATA_JSON Invalid response body while trying to fetch https://registry.npmjs.org/pnpm: aborted
该报错由registry.npmjs.org受某网络因素影响无法访问,需要切换国内镜像。
查看、设置镜像
1. 查看 npm 的 registry
# npm
npm config get registry
# ppm
pnpm config get registry
# yarn
yarn config get registry
2. 常用镜像源
npm 官方源:registry.npmjs.org
阿里云镜像源:registry.npmmirror.com
腾讯云镜像源:mirrors.cloud.tencent.com/npm
3. 配置 npm、pnpm、yarn 的 registry
# npm
npm config set registry=https://registry.npmjs.org
# pnpm
pnpm config set registry=https://registry.npmjs.org
# yarn
yarn config set registry=https://registry.npmjs.org