vagrant-proxyconf“split”:错误的URI“错误安装Vagrant的插件

请注意,我正在Windows环境中运行这个。

我在一个公司代理的后面工作,试图让vagrant-proxyconf插件工作,这样stream浪的机器就可以通过代理来设置。 但是,在执行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/ 

搞清楚它可能是一个代理问题,我尝试设置我的环境variables:

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>' 

注意错误: 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'

似乎是不正确地解释环境variables,并有问题解释呢? 任何人都知道如何解决这个问题?

你甚至可能不需要引号(除非密码包含一些有趣的字符)。 所以你可以试试:

 set HTTP_PROXY=http://username:password@proxy:port 

如果你需要报价,正确的形式是:

 set "HTTP_PROXY=http://username:password@proxy:port"