Jaco Pretorius
Jaco Pretorius

Reputation: 24840

Bundle succeeds but doesn't load all gems

I am inheriting a Rails application and I'm having problems getting the app running. As I would except there is a .rvmrc, Gemfile and Gemfile.lock in the repo which - in my mind - should allow me to resolve all dependencies properly.

When I run bundle install everything seems to get installed correctly, but when I run bundle console I get an error that nokogiri cannot be loaded:

/Users/MyUser/.rvm/gems/ruby-2.0.0-p247@appname/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- nokogiri/nokogiri (LoadError)

I find this incredibly confusing - how is it possible that bundler loads all the requirements as specified in the Gemfile.lock and the doesn't find them? It doesn't seem to be a problem with a specific gem either - when I comment out the gem in question it simply seems to fail on the next one (unfortunately this app requires around 200 gems).

If I do run bundle show nokogiri it spits out the correct path. How do I get to the root of this problem? I've never had issues with bundler so I am really stumped as to what the problem could be.

Upvotes: 2

Views: 625

Answers (2)

Jaco Pretorius
Jaco Pretorius

Reputation: 24840

I finally managed to fix this issue by making sure all local gems are uninstalled and then running bundle install --path vendor/bundler

Still no idea what was wrong though.

Upvotes: 2

bratsche
bratsche

Reputation: 2674

Does "bundle exec rails console" work?

Upvotes: 1

Related Questions