mirror priority:
Project .npmrc > Global .npmrc > Default mirror source Project .yarnrc > Global .yarnrc > Default mirror source
-
Restore to default repository
npm config delete registry #or npm config set registry https://registry.npmjs.org/
-
Get current mirror
npm config get registry
-
Set mirror
npm config set registry http://registry.npm.taobao.org/ #other mirrors npm config set disturl https://npm.taobao.org/dist npm config set electron_mirror https://npm.taobao.org/mirrors/electron/ npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/
Or Edit
~/.npmrc
file to set.registry=https://registry.npm.taobao.org sass_binary_site=https://npm.taobao.org/mirrors/node-sass/ phantomjs_cdnurl=http://cnpmjs.org/downloads electron_mirror=https://npm.taobao.org/mirrors/electron/ sqlite3_binary_host_mirror=https://foxgis.oss-cn-shanghai.aliyuncs.com/ profiler_binary_host_mirror=https://npm.taobao.org/mirrors/node-inspector/ chromedriver_cdnurl=https://cdn.npm.taobao.org/dist/chromedriver
-
Restore to default repository
yarn config delete registry #or yarn config set registry https://registry.yarnpkg.com
-
Get current mirror
yarn config get registry
-
Set mirror
yarn config set registry http://registry.npm.taobao.org/ #other mirrors yarn config set disturl https://npm.taobao.org/dist -g yarn config set electron_mirror https://npm.taobao.org/mirrors/electron/ -g yarn config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ -g yarn config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/ -g
Or Edit
~/.yarnrc
file to set.registry "https://registry.npm.taobao.org" sass_binary_site "https://npm.taobao.org/mirrors/node-sass/" phantomjs_cdnurl "http://cnpmjs.org/downloads" electron_mirror "https://npm.taobao.org/mirrors/electron/" sqlite3_binary_host_mirror "https://foxgis.oss-cn-shanghai.aliyuncs.com/" profiler_binary_host_mirror "https://npm.taobao.org/mirrors/node-inspector/" chromedriver_cdnurl "https://cdn.npm.taobao.org/dist/chromedriver"