帮助!我正在尝试安装Mongoid gem:
如果我运行'gem install mongoid',我会得到以下结果:
> ERROR: While executing gem ... (NoMethodError)
> undefined method `from' for Gem::Package::TarHeader:Class
如果我在我的gemfile中包含mongoid,如下所示,然后运行bundle:
source "http://rubygems.org"
source "http://gems.rubyforge.org"
source "http://gemcutter.org"
gem "mongoid", "~> 2.0"
我明白了......
bundle
Fetching source index for http://rubygems.org/
Fetching source index for http://gems.rubyforge.org/
Fetching source index for http://gemcutter.org/
/Users/lsayers/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_reader.rb:58:in `block in each': undefined method `from' for Gem::Package::TarHeader:Class (NoMethodError)
from /Users/lsayers/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_reader.rb:55:in `loop'
from /Users/lsayers/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_reader.rb:55:in `each'
from /Users/lsayers/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_input.rb:35:in `initialize'
from /Users/lsayers/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_input.rb:20:in `new'
from /Users/lsayers/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_input.rb:20:in `open'
from /Users/lsayers/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/package.rb:44:in `open'
from /Users/lsayers/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/format.rb:62:in `from_io'
from /Users/lsayers/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/format.rb:46:in `block in from_file_by_path'
from /Users/lsayers/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/open-uri.rb:35:in `open'
from /Users/lsayers/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/open-uri.rb:35:in `open'
from /Users/lsayers/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/format.rb:45:in `from_file_by_path'
from /Users/lsayers/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:100:in `spec_from_gem'
from /Users/lsayers/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/source.rb:77:in `fetch'
from /Users/lsayers/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/installer.rb:50:in `block in run'
from /Users/lsayers/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `block in each'
from /Users/lsayers/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `each'
from /Users/lsayers/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `each'
from /Users/lsayers/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/installer.rb:49:in `run'
from /Users/lsayers/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/installer.rb:8:in `install'
from /Users/lsayers/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/cli.rb:222:in `install'
from /Users/lsayers/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/vendor/thor/task.rb:22:in `run'
from /Users/lsayers/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /Users/lsayers/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /Users/lsayers/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/vendor/thor/base.rb:389:in `start'
from /Users/lsayers/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/bin/bundle:13:in `<top (required)>'
from /Users/lsayers/.rvm/gems/ruby-1.9.2-p180/bin/bundle:19:in `load'
from /Users/lsayers/.rvm/gems/ruby-1.9.2-p180/bin/bundle:19:in `<main>'
我不知道发生了什么事?它看起来像是宝石的错误,但我想也许这是我的机器或其他东西?
答案 0 :(得分:1)
我跑了:
rvm rubygems latest
然后
rvm gem install mongoid
并且它有效:)捆绑运行现在很好:))