NPM
# 查看镜像
npm config get registry
# 设置淘宝镜像
npm config set registry https://registry.npmmirror.com
# 设置官方镜像
npm config set registry https://registry.npmjs.org
# 使用淘宝镜像安装依赖
npm install xxx --registry=https://registry.npmmirror.com
YARN
# 查看镜像
yarn config get registry
# 设置淘宝镜像
yarn config set registry https://registry.npmmirror.com
# 设置官方镜像
yarn config set registry https://registry.yarnpkg.com
# 使用淘宝镜像安装依赖
yarn add xxx --registry=https://registry.npmmirror.com