2014-10-16 65 views
2

請注意,我在Windows環境中運行此操作。vagrant-proxyconf「split」:錯誤的URI「安裝Vagrant插件時出現錯誤

我在一個公司代理的後面工作,並試圖讓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:[email protected]:port"

重新執行後插件install命令時,我得到一個不同的錯誤:

C:/Vagrant/embedded/lib/ruby/2.0.0/uri/common.rb:176:in `split': bad URI(is not 
 
URI?): http://"http://username:[email protected]: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:[email protected]:port" (URI::InvalidURIError) from C:/Vagrant/embedded/lib/ruby/2.0.0/uri/common.rb:211:in parse'

好像它是不正確的解釋環境變量,並具有解釋它的問題?任何人都知道如何解決這個問題?

回答

5

你甚至不需要引號(除非密碼包含一些有趣的字符)。所以,你可以只是嘗試:

set HTTP_PROXY=http://username:[email protected]:port 

如果您需要報價,正確的形式是:

set "HTTP_PROXY=http://username:[email protected]:port" 
+0

真棒,這個工作!這樣一個小錯誤 – Shark 2014-10-27 18:19:33

+0

也從我身邊感謝,我有完全相同的問題。我在我的Vagrant安裝的bin文件夾中運行命令的一個問題。這是你需要運行命令的唯一正確的目錄嗎?謝謝 – paranza 2016-03-09 11:15:57

+0

@innuendo只要爲運行'vagrant'命令的shell會話設置變量,目錄就無關緊要。 – tmatilai 2016-03-10 08:20:58