遗失的宝石和捆绑者冲突的情况

时间:2013-03-01 23:53:00

标签: ruby-on-rails ruby gem bundler

在我的rails应用程序目录之外,当我的意思是bundle install _a_gem_时,我意外地运行了gem install _a_gem。这已经很长时间了。在此之后,我无法让我的环境工作。在我的应用程序中运行gem list只给我_a_gem_我稍后安装。在我的应用程序之外运行gem list可以获得我想要的宝石列表以及我最初使用的应用程序。

(o)外部应用程序目录 (i)内部申请目录

哪个宝石

/Users/name/.rvm/rubies/ruby-1.9.2-p290/bin/gem   (o)
/Users/name/.rvm/rubies/ruby-1.9.2-p290/bin/gem   (i)

哪个irb

/Users/name/.rvm/rubies/ruby-1.9.2-p290/bin/irb   (o)
/Users/name/.rvm/rubies/ruby-1.9.2-p290/bin/irb   (i)


bundle install (o)
Could not locate Gemfile 

bundle install (i)
/Users/...rubygems/dependency.rb:247:in `to_specs': Could not find bundler (>= 0) amongst [spreadsheet-0.8.2] (Gem::LoadError)

宝石清单 (o)所有宝石(i)都只有_a_gem_来自我的rails应用程序。

gems / bundler命令可以在应用程序目录中的任何位置正常工作。我尝试重新安装捆绑包但发生了冲突:

(ⅰ)

/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1603:in    `raise_if_conflicts': can't activate bundler-1.3.0, already activated bundler-1.0.21 (Gem::LoadError)

非常感谢任何帮助。谢谢。

EXTRA: 从gem install bundler开始尝试使用bundle install

等捆绑命令时的跟踪
/Users/name/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1603:in `raise_if_conflicts': can't activate bundler-1.3.0, already activated bundler-1.0.21 (Gem::LoadError)
from /Users/name/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:738:in `activate'
from /Users/name/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:1211:in `gem'
from /Users/name/.rvm/gems/ruby-1.9.2-p290/bin/bundle:18:in `<main>'

更新:gem env输出目录内外

https://gist.github.com/yuric/5069049

1 个答案:

答案 0 :(得分:2)

我发现这套说明非常有助于解决捆绑问题:

# remove user-specific gems and git repos
rm -rf ~/.bundle/ ~/.gem/

# remove system-wide git repos and git checkouts
rm -rf $GEM_HOME/bundler/ $GEM_HOME/cache/bundler/

# remove project-specific settings and git repos
rm -rf .bundle/

# remove project-specific cached .gem files
rm -rf vendor/cache/

# remove the saved resolve of the Gemfile
rm -rf Gemfile.lock

# try to install one more time
bundle install

这是github上原始页面的链接,我在这些页面中遇到了这些链接。他们通常会为我解决捆绑问题。

https://github.com/carlhuda/bundler/blob/1-0-stable/ISSUES.md