在代理后无法执行vagrant up

6
我无法在Windows 7机器上公司代理后执行vagrant up(或vagrant add)。我已经尝试使用http_proxy / https_proxy环境变量,也尝试使用vagrant插件vagrant-proxyconf和各种http代理设置,但都没有帮助。问题不在于客户端的代理,而是主机的代理。有没有办法让vagrant本身使用代理?
vagrant up的输出:
C:\scratch\vagrant>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'hashicorp/pricise32' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
The box 'hashicorp/pricise32' could not be found or
could not be accessed in the remote catalog. If this is a private
box on Vagrant Cloud, please verify you're logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:

URL: ["https://vagrantcloud.com/hashicorp/pricise32"]
Error: The requested URL returned error: 404 Not Found

插件:

C:\scratch>vagrant plugin list
vagrant-login (1.0.1, system)
vagrant-proxyconf (1.2.0)
vagrant-share (1.0.1, system)

Vagrant 版本:

C:\scratch\vagrant>vagrant -v
Vagrant 1.5.4

1
有一个打字错误:正确的盒子名称可能是“hashicorp/precise32”。 - Emyl
是的,似乎那就是问题所在,Emyl。感谢您的发现。我一直在解决代理问题,但在某个环节中弄错了盒子名称。@tmatilai在下面提供的使用环境代理变量的答案解决了问题。 - Dave Remy
2个回答

16
作为@Emyl指出,你的盒子名称有一个拼写错误(应该是“hashicorp / precise32”)。
回答问题,Vagrant支持主机上的标准HTTP_PROXYHTTPS_PROXY环境变量。在Windows上,您可以在命令行上设置它们:
set HTTP_PROXY="http://proxy:1234"
set HTTPS_PROXY="http://proxy:1234"

未来vagrant-proxyconf也计划在某些情况下自动设置它们。


是的,上面有错别字,修正后就可以了。谢谢! - Dave Remy
2
用双引号时对我不起作用,我必须将它们删除。 - Mike Argyriou
你怎么知道代理信息是什么? - prayagupa

11

对我有用,但不需要加双引号。

set HTTP_PROXY=http://proxy:1234
set HTTPS_PROXY=http://proxy:1234

替代:

set HTTP_PROXY="http://proxy:1234"
set HTTPS_PROXY="http://proxy:1234"

1
我认为这应该是被接受的答案,因为双引号会导致使用 Vagrant 时出现错误("unsupported proxy scheme")。 - relief.melone

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接