2013-03-01 56 views
1

我的Rails應用程序目錄之外我意外地跑bundle install _a_gem_當我的意思是gem install _a_gem。這已經很長時間了。在此之後,我無法讓我的環境工作。在我的應用程序中運行gem list後,我只是安裝了_a_gem_。在我的應用程序之外運行gem list可以提供我期望的gem列表以及我最初使用的應用程序。缺少寶石和捆綁器衝突的情況

(O)以外的內部應用程序目錄應用程序目錄 (ⅰ)

其中寶石

/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)具有所有寶石(ⅰ )剛剛從我的Rails應用程序中創建_a_gem_。

gems/bundler命令幾乎可以在應用程序目錄內的任何地方正常工作。我嘗試重新安裝捆綁卻得到了一個矛盾:

(I)

/.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

+0

你能打印gem env在dir內部和外部嗎? – gmaliar 2013-03-01 23:59:57

+0

在(i)dir中是否有任何.rvm文件?當你想到它時會發生什麼?也許是'.rvmrc'文件? – gmaliar 2013-03-02 00:40:26

+0

沒有任何rvm相關,我可以告訴。我有一個.bundle – Yuri 2013-03-02 00:44:14

回答

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

+0

它正在啓動:/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby – Yuri 2013-03-02 02:11:07

+0

從上面的行,它使用紅寶石1.8一些原因? Ruby -v list 1.9.2 – Yuri 2013-03-02 02:12:11

+0

如果從應用程序目錄輸入'rvm list',你會得到什麼? – 2013-03-02 02:21:26