npm及yarn设置和取消代理的方法

npm设置代理

1
2
3
4
5
# npm config set proxy http://192.168.16.28:8118
# npm config set https-proxy http://192.168.16.28:8118
# npm config set registry=https://registry.npm.taobao.org
# npm config ls
# npm install -g yarn

代理用户名和密码

1
2
npm config set proxy http://username:password@server:port
npm confit set https-proxy http://username:password@server:port

或者编辑用户目录下的~/.npmrc file

1
2
proxy=http://username:password@host:port
https-proxy=http://username:password@host:port

npm取消代理

1
2
npm config delete proxy
npm config delete https-proxy

yarn代理配置

1
2
yarn config set proxy http://username:password@host:port
yarn config set https-proxy http://username:password@host:port

Powered by AppBlog.CN     浙ICP备14037229号

Copyright © 2012 - 2020 APP开发技术博客 All Rights Reserved.

访客数 : | 访问量 :