淘宝 npm 地址: http://npm.taobao.org/
npm 临时使用
# 以 events 依赖包为例
npm --registry <https://registry.npmmirror.com> install events --save
npm 持久使用
npm config set registry <https://registry.npmmirror.com>
# 验证:通过以下方式验证结果
npm config get registry
# 使用:以 events 依赖包为例
npm install events --save
cnpm 使用
npm install -g cnpm --registry=https://registry.npmmirror.com
# 使用:以 events 依赖包为例
cnpm install events --save
还原 npm 仓库地址:
npm config set registry <https://registry.npmjs.org/>
查看当前地址
yarn config get registry
修改源地址为淘宝 NPM 镜像
yarn config set registry <https://registry.npmmirror.com/>
修改源地址为官方源
yarn config set registry <https://registry.yarnpkg.com>