yarn和npm切换镜像源、设置代理
镜像源以淘宝为例
npm镜像源
设置淘宝
shell
npm config set registry https://registry.npmmirror.com
设置默认
shell
npm config set registry https://registry.npmjs.org/
查看结果
shelll
npm get registry
npm代理
设置代理
shell
npm config set proxy http://127.0.0.1:1080
npm config set https-proxy http://127.0.0.1:1080
删除代理
shell
npm config delete proxy
npm config delete https-proxy
yarn相关
yarn和npm相同。将上述shell中的npm修改为yarn即可。
注意,查看结果yarn需要添加config
shell
yarn config get registry
sass相关
以上配置可能安装node-sass
还是会很忙,有时候还会出错,找了一下解决方案:
# npm
npm config set sass-binary-site http://npm.taobao.org/mirrors/node-sass
# yarn
yarn config set sass-binary-site http://npm.taobao.org/mirrors/node-sass