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

topswim · October 17, 2012 · Last by seraphim_houwei replied at March 06, 2015 · 20111 hits

在下载 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

You need to Sign in before reply, if you don't have an account, please Sign up first.