Toggle proxy env variables (HTTP_PROXY and HTTPS_PROXY) in command line.
npm i -g proxy-cmd
Press Win + R
, input "cmd", then press Ctrl + Shift + Enter
, open cmd as administrator
# Init proxy
proxy-cmd init 'http://127.0.0.1:7890'
# Set proxy env variables in context process
# HTTP_PROXY=http://127.0.0.1:8234
# HTTPS_PROXY=http://127.0.0.1:8234
proxy-on
# Del proxy env variables in context process
proxy-off
# Set global proxy env variables, needs administrator privileges
# Needs restart the terminal after running this command!!!
# HTTP_PROXY=http://127.0.0.1:8234
# HTTPS_PROXY=http://127.0.0.1:8234
proxy-cmd set
# Del global proxy env variables, needs administrator privileges
# Needs restart the terminal after running this command!!!
proxy-cmd del
# Show proxy target url
proxy-cmd url
# Change proxy target url
proxy-cmd url 'http://127.0.0.1:8234'
# Show NO_PROXY config
proxy-cmd np
# Change NO_PROXY config
proxy-cmd np 'localhost,127.0.0.1'
# Delete NO_PROXY config
proxy-cmd np del
Run the following commands in terminal
# Init proxy
sudo proxy-cmd init 'http://127.0.0.1:7890'
# Set proxy env variables in context process, should source .zshrc or .bashrc first
# HTTP_PROXY=http://127.0.0.1:8234
# HTTPS_PROXY=http://127.0.0.1:8234
proxy-on
# Del proxy env variables in context process, should source .zshrc or .bashrc first
proxy-off
# Set global proxy env variables
# Needs restart the terminal after running this command!!!
# HTTP_PROXY=http://127.0.0.1:8234
# HTTPS_PROXY=http://127.0.0.1:8234
sudo proxy-cmd set
# Del global proxy env variables
# Needs restart the terminal after running this command!!!
sudo proxy-cmd del
# Enable proxy-cmd alias
sudo source ~/.bashrc
# MacOs only
sudo source ~/.zshrc
# Show proxy target url
sudo proxy-cmd url
# Change proxy target url
sudo proxy-cmd url 'http://127.0.0.1:8234'
# Show NO_PROXY config
sudo proxy-cmd np
# Change NO_PROXY config
sudo proxy-cmd np 'localhost,127.0.0.1'
# Delete NO_PROXY config
sudo proxy-cmd np del