Node.js包管理工具镜像源切换
以下是一些常用的命令,用于在不同的包管理工具中切换镜像源。
-
npm切换镜像源 -
切换到淘宝镜像:
npm config set registry https://registry.npm.taobao.org
-
切换回官方镜像:
npm config set registry https://registry.npmjs.org
-
cnpm切换镜像源 -
切换到官方镜像:
npm install -g cnpm --registry=https://registry.npmjs.org
-
切换到淘宝镜像:
npm install -g cnpm --registry=https://registry.npm.taobao.org
-
yarn切换镜像源 -
切换到淘宝镜像:
yarn config set registry https://registry.npm.taobao.org
-
切换回官方镜像:
yarn config set registry https://registry.yarnpkg.com
-
注:
-
pnpm 不需要切换镜像源,因为它使用了一个独特的分布式存储,不需要像 npm 或 cnpm 一样下载所有包。
-