注意,我在Windows环境中运行它。
我在公司代理服务器后面工作,并尝试让vagrant-proxyconf插件正常工作,以便将流浪者计算机设置为通过代理服务器工作。但是,在执行vagrant plugin install vagrant-proxyconf
时,我收到以下错误:
Bundler, the underlying system Vagrant uses to install plugins, reported an error. The error is shown below. These errors are usually caused by misconfigured plugin installations or transient network issues. The error from Bundler is:
Could not fetch specs from http://gems.hashicorp.com/
Retrying source fetch due to error (2/3): Bundler::HTTPError Could not fetch specs from http://gems.hashicorp.com/Retrying source fetch due to error (3/3): Bundler::HTTPError Could not fetch specs from http://gems.hashicorp.com/
确定它可能是代理问题,我尝试设置我的环境变量:
set HTTP_PROXY="http://username:password@proxy:port"
重新执行插件安装命令后,我得到了一个不同的错误:
C:/Vagrant/embedded/lib/ruby/2.0.0/uri/common.rb:176:in `split': bad URI(is not
URI?): http://"http://username:password@proxy:port" (URI::InvalidURIError)
from C:/Vagrant/embedded/lib/ruby/2.0.0/uri/common.rb:211:in `parse'
from C:/Vagrant/embedded/lib/ruby/2.0.0/uri/common.rb:747:in `parse'
from C:/Vagrant/embedded/lib/ruby/2.0.0/uri/common.rb:996:in `URI'
from C:/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/vendor/net/
http/persistent.rb:908:in `proxy_from_env'
from C:/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/vendor/net/
http/persistent.rb:858:in `proxy='
from C:/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/vendor/net/
http/persistent.rb:528:in `initialize'
from C:/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/fetcher.rb:
113:in `new'
from C:/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/fetcher.rb:
113:in `connection'
from C:/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/fetcher.rb:
103:in `initialize'
from C:/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/source/ruby
gems.rb:262:in `new'
from C:/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/source/ruby
gems.rb:262:in `block in remote_specs'
from C:/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/source/ruby
gems.rb:262:in `map'
from C:/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/source/ruby
gems.rb:262:in `remote_specs'
from C:/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/source/ruby
gems.rb:202:in `fetch_specs'
from C:/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/source/ruby
gems.rb:66:in `specs'
from C:/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/definition.
rb:216:in `block (2 levels) in index'
from C:/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/definition.
rb:213:in `each'
from C:/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/definition.
rb:213:in `block in index'
from C:/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/index.rb:9:
in `build'
from C:/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/definition.
rb:209:in `index'
from C:/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/definition.
rb:203:in `resolve'
from C:/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/definition.
rb:133:in `specs'
from C:/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/definition.
rb:122:in `resolve_remotely!'
from C:/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/installer.r
b:76:in `run'
from C:/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/installer.r
b:15:in `install'
from C:/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/bundler.rb:
226:in `block in internal_install'
from C:/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/bundler.rb:
284:in `block in with_isolated_gem'
from C:/Vagrant/embedded/lib/ruby/2.0.0/rubygems/user_interaction.rb:40:
in `use_ui'
from C:/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/bundler.rb:
283:in `with_isolated_gem'
from C:/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/bundler.rb:
225:in `internal_install'
from C:/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/bundler.rb:
92:in `install'
from C:/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/plugin/mana
ger.rb:62:in `block in install_plugin'
from C:/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/plugin/mana
ger.rb:72:in `call'
from C:/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/plugin/mana
ger.rb:72:in `install_plugin'
from C:/Vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/commands/plugin
/action/install_gem.rb:37:in `call'
from C:/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/ward
en.rb:34:in `call'
from C:/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/buil
der.rb:116:in `call'
from C:/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runn
er.rb:66:in `block in run'
from C:/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/util/busy.r
b:19:in `busy'
from C:/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runn
er.rb:66:in `run'
from C:/Vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/commands/plugin
/command/base.rb:14:in `action'
from C:/Vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/commands/plugin
/command/install.rb:32:in `block in execute'
from C:/Vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/commands/plugin
/command/install.rb:31:in `each'
from C:/Vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/commands/plugin
/command/install.rb:31:in `execute'
from C:/Vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/commands/plugin
/command/root.rb:56:in `execute'
from C:/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/cli.rb:42:i
n `execute'
from C:/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment
.rb:292:in `cli'
from C:/Vagrant/embedded/gems/gems/vagrant-1.6.5/bin/vagrant:174:in `<ma
in>'
&#13;
请注意错误:
C:/Vagrant/embedded/lib/ruby/2.0.0/uri/common.rb:176:in 'split': bad URI(is not URI?): http://"http://username:password@proxy:port" (URI::InvalidURIError) from C:/Vagrant/embedded/lib/ruby/2.0.0/uri/common.rb:211:in parse'
似乎它错误地解释了环境变量并解释了它的问题?有谁知道如何解决这个问题?
答案 0 :(得分:5)
你甚至不需要引号(除非密码包含一些有趣的字符)。所以你可以试试:
set HTTP_PROXY=http://username:password@proxy:port
如果您需要报价,请填写正确的表格:
set "HTTP_PROXY=http://username:password@proxy:port"