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.
This error may raise when you update your ruby but not the related gems.
To check if this is your case, try to make a new rails app in a new empty directory (to be sure RVM is not autoloading any gemset)
If this fails stating that it cannot find a suitable 'rails', then simply run
and overwrite any conflicting rails.
Uninstalling all my versions of Bundler, and then installing the latest version fixed it for me. I had multiple versions of bundler installed, so when I ran
bundle exec rails s
I think the wrong Bundler was used, giving me the warning message.You may need to generate new stubs after reinstalling Bundler, but I didn't have to.
Solution in my case: - Other solutions didn't work for me.
In your Rails directory:
Also be sure that bin/rails is added to the path like:
Good luck.
What worked for me was
rm -rf bin/*
Then open a new terminal session and
bundle exec spring binstub --all
I was able to fix this by looking at the commit history for
bin/rails
usinggit log -p bin/rails
The current, error producing content is:
The original, non-error content was:
When I restored the original bin/rails content, the warning message disappeared. Previous attempts had returned
uninitialized constant Bundler
errors on allbundle exec
commands, but now they work. It's worth noting that the original content appears to be exactly whatrails new blabla
generates in rails 4.0.x.Still, I would like to know why the first code block causes issues because it's exactly what
bundle install --binstubs
generates.Edit: turns out this solution does not work. Pushed this fix to a heroku staging server and heroku errors on startup: all
bin/rails
commands throwuninitialized constant Bundler
and heroku starts up withbin/rails server .....
so this is a not really a fix.Edit2:
If I add these two lines to the second block (the original bin/rails content), all
bin/rails
commands are working again:My guess is that the second line is what fixes the bundler errors I was having.
Interestingly, when I tried to edit the first block of code in this post to try and debug which line was throwing the warning, any change I made caused all
rails
commands to failure, with no information except for the nag note in the OP. weird.Final
bin/rails
that fixed my issue:Any additional insight from people who find this would be welcome!