反馈 使用 gem 淘宝镜像报错?

topswim · 2012年10月17日 · 最后由 seraphim_houwei 回复于 2015年03月06日 · 20141 次阅读

在下载 gem 包时报错,怎么办? [ruby@localhost Downloads]$ gem source -r https://rubygems.org/ source https://rubygems.org/ not present in cache [ruby@localhost Downloads]$ gem source -a http://ruby.taobao.org /home/ruby/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require': no such file to load -- zlib (LoadError) from /home/ruby/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:inrequire' from /home/ruby/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems.rb:540:in gunzip' from /home/ruby/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/remote_fetcher.rb:239:infetch_path' from /home/ruby/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:269:in load_specs' from /home/ruby/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/commands/sources_command.rb:72:inexecute' from /home/ruby/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/command.rb:278:in invoke' from /home/ruby/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:147:inprocess_args' from /home/ruby/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:117:in run' from /home/ruby/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:65:inrun' from /home/ruby/.rvm/rubies/ruby-1.9.2-p320/bin/gem:25:in `'

这个好像是你的 ruby 环境没装好啊

gem source -r https://rubygems.org/ 把里面的"https"改成“http”就行了

gem sources -r https://rubygems.org/ gem sources -a http://ruby.taobao.org/

是 sources,而不是 source

需要 登录 后方可回复, 如果你还没有账号请 注册新账号