- 查看当前镜像源
yarn config get registry
npm config get registry
2.临时修改源
yarn save package_name --registry https://registry.npm.taobao.org/
3.修改源为taobao源
yarn config set registry https://registry.npm.taobao.org/
npm config set registry https://registry.npm.taobao.org/
4.修改源为官方源
yarn config set registry https://registry.yarnpkg.com
npm config set registry https://registry.npmjs.org/
- 使用 cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
# 安装成功后,使用方法同npm
cnpm install
网友评论