在使用 npm 和 yarn 官方數據源下載依賴時常出現速度慢或是無法連接的情況,這時我們可以將 npm 和 yarn 的數據源修改國內的 taobao 鏡像源
- npm 查看當前使用的數據源
npm config get registry
- npm 修改數據源爲 taobao
npm config set registry 'https://registry.npm.taobao.org'
- yarn 查看當前使用的數據源
yarn config get registry
- yarn 修改數據源爲 toabao
yarn config set registry 'https://registry.npm.taobao.org'
- 配置 NPM 淘寶鏡像
npm install -g cnpm --registry=https://registry.npm.taobao.org