查看registry
# npm命令 npm config get registry # yarn命令 yarn config get registry
cnpm淘寶鏡像安裝
npm install -g cnpm -registry=https://registry.npm.taobao.org
設置為淘寶鏡像
# npm命令 npm config set registry http://registry.npm.taobao.org/
# yarn命令
yarn config set registry http://registry.npm.taobao.org/
設置為原鏡像
# npm命令 npm config set registry http://registry.npmjs.org/ # yarn命令 yarn config set registry http://registry.npmjs.org/ 或者 yarn config set registry https://registry.yarnpkg.com
參考地址1:https://www.cnblogs.com/lkc9/p/12538914.html
參考地址2:https://developer.aliyun.com/mirror/NPM?from=tnpm