轨。宝石包失败了

时间:2011-08-06 23:53:49

标签: ruby-on-rails ruby rubygems bundler

我跑完后

  

捆绑安装

我得到了:

  

/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:14:in <top (required)>': undefined method删除'for Gem :: QuickLoader:Module   (NoMethodError)from:158:in require' from <internal:gem_prelude>:158:in load_full_rubygems_library'from   :280:method_missing' from /usr/local/bin/bundle:19:in'   垫@的MacBook-PRO〜/文档/工作区/回报率/ rails_projects / sample_app $

编辑:

>bundle -v 
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:14:in `<top (required)>': undefined method `remove' for Gem::QuickLoader:Module (NoMethodError)
    from <internal:gem_prelude>:158:in `require'
    from <internal:gem_prelude>:158:in `load_full_rubygems_library'
    from <internal:gem_prelude>:280:in `method_missing'
    from /usr/local/bin/bundle:19:in `<main>'

mat@Macbook-Pro~$ gem -v
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:86:in `<top (required)>': undefined method `load_plugins' for Gem:Module (NoMethodError)
    from /usr/local/bin/gem:9:in `require'
    from /usr/local/bin/gem:9:in `<main>'

我的Gemfile是:

&GT;

 source 'http://rubygems.org'

gem 'rails', '3.0.9'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3', '1.3.3'

group :development do
  gem 'rspec-rails', '2.6.1'
end

group :test do
  gem 'rspec-rails', '2.6.1'
  gem 'webrat', '0.7.1'
end

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'

# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'

# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
#   gem 'webrat'
# end

有人能帮帮我吗?谢谢!

2 个答案:

答案 0 :(得分:2)

我遇到了类似的错误:

$ bundle -v

/Users/Reza/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/site_ruby/1.9.1/rubygems.rb:14:in `<top         (required)>': undefined method `remove' for Gem::QuickLoader:Module (NoMethodError)

似乎所有 [..] / ruby​​gems.rb未定义的方法[..] 问题都与安装的rubygems之间的冲突(例如通过rvm ruby​​gems)和ruby中的rubygems方法内置有关1.9.x的

只需重命名已安装的rubygems文件,问题就解决了。

$ which ruby
/Users/Reza/.rvm/rubies/ruby-1.9.2-rc2/bin/ruby
$ echo $MY_RUBY_HOME
/Users/Reza/.rvm/rubies/ruby-1.9.2-rc2
$ cd "$MY_RUBY_HOME/lib/ruby/site_ruby/1.9.1/"
$ mv rubygems.rb rubygems.rb-rename
$ mv rubygems rubygems-rename
$ bundle -v
Bundler version 1.0.18

答案 1 :(得分:1)

尝试从此处手动更新到最新的RubyGems版本:

http://rubygems.org/pages/download

1. Download the latest rubygems 
   http://production.cf.rubygems.org/rubygems/rubygems-1.8.7.tgz
2. Extract it 
   tar zxvf rubygems-1.8.7.tgz
3. Install it
   cd rubygems-1.8.7
   sudo ruby setup.rb

如果这没有帮助,您可以尝试从这里下载旧版本的rubygems:
http://rubyforge.org/frs/?group_id=126

例如1.8.5,1.8.0,1.7.0,1.6.0。