npm 设置和取消代理的方法

设置代理

1 npm config set proxy=http://127.0.0.1:8087
2 npm config set registry=http://registry.npmjs.org

关于http

经过上面设置使用了http开头的源,因此不需要设http_proxy了,否则还要加一句

1 npm config set https-proxy http://server:port

 代理用户名和密码

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

取消代理

1 npm config delete proxy
2 npm config delete https-proxy
原文地址:https://www.cnblogs.com/haishen/p/10722530.html