yarn和npm切换镜像源、设置代理

913#ced65eab

意在解决安装缓慢,和git类似

git clone项目开启代理

镜像源以淘宝为例

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

参与本文讨论

请先登录 GitHub 后留言

0/500

本文留言

0

这篇文章还没有留言,来写第一条吧。

1 / 1