Yuri
Yuri

Reputation: 1331

the case of the missing gems and bundler conflict

Outside of my rails application directory I accidentally ran bundle install _a_gem_ when I meant gem install _a_gem. It has been some long hours. After this I haven't been able to get my environment working. Running gem list inside of my application gives me just the _a_gem_ I later installed. Running gem list outside of my application gives me my desired gem list and the ones I was originally was using with the app.

(o) outside application directory (i) inside application directory

which gem

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

which 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)

gem list (o) has all gems (i) has just _a_gem_ from within my rails app.

The gems/bundler commands work fine just about anywhere but inside the application directory. I tried reinstalling bundler but got a conflict:

(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)

Any help is greatly appreciated. Thank you.

EXTRA: The trace from when I gem install bundler then try a bundler command such as 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>'

UPDATE: gem env output inside and outside of directory

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

Upvotes: 1

Views: 797

Answers (1)

Kevin Bedell
Kevin Bedell

Reputation: 13404

I've found this set of instructions invaluable for resolving bundler issues:

# 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

Here's a link to the original page on github where I ran across these. They normally resolve bundler issues for me.

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

Upvotes: 2

Related Questions