Bundler and wrong binstubs?

user2936314 picture user2936314 · Apr 19, 2014 · Viewed 12.7k times · Source

I run rails s or bundle exec rails s and I get this warning:

Bundler is using a binstub that was created for a different gem.
This is deprecated, in future versions you may need to `bundle binstub rails` to work around a system/bundle conflict.

What does this mean? From looking around the bundler site, my understanding of binstubs is that you can set executables to them, so instead of running bundle exec blabla you can just do bin/blabla. So this error is saying my bundler isn't set to the right binstub?

When I run the bundle binstub rails I get this output

rails has no executables, but you may want one from a gem it depends on.
  railties has: rails
  bundler has: bundle, bundler

I do not understand what my system is trying to tell me, and it's not breaking anything, but I have a hunch this could turn into a bigger issue if I don't fix it

ruby 2.0.0p247

which ruby

/Users/evan/.rvm/rubies/ruby-2.0.0-p247/bin/ruby

which bundler

/Users/evan/.rvm/gems/ruby-2.0.0-p247/bin/bundler

Rails 4.0.2

Edit:

So, if I run the commands in the nag message:

  bundle config --delete bin    # Turn off Bundler's stub generator
  rake rails:update:bin         # Use the new Rails 4 executables

I end up getting uninitialized constant Bundler errors with bundle exec commands and the only way I've found to fix that is to rerun bundle install --binstubs which brings back the nag message at the start of this post.

Answer

Ju Liu picture Ju Liu · May 14, 2014

What worked for me was

rm -rf bin/*

Then open a new terminal session and

bundle exec rake app:update:bin