Erroneous Bundler::RubyVersionMismatch #2489
Comments
One thought is that it's something to do with rbenv and trying to run something using global ruby (1.9.3) instead of local ruby (2.0.0), but I can't work out why...? |
You may have a hard-coded shebang in the executable you are running. You can check it with "head On Thu, May 30, 2013 at 9:26 PM, Ian Chilton notifications@github.com
|
rake is an rbenv shim (in ~/.rbenv/shims/rake) and starts with this: $ head |
Sounds like an rbenv issue, then. Maybe you should ask them? On Thu, May 30, 2013 at 11:42 PM, Ian Chilton notifications@github.com
|
I was wondering that - thanks. |
rbenv guys are saying it's bundler's problem: rbenv/rbenv#400 It's not system ruby since the stack trace comes from:
which clearly indicates that you're running 2.0. I would rather believe this is a bug with Bundler's version check. |
Well, as you can see from the backtrace you originally posted here, you are somehow loading the Bundler installed into Ruby 2... From the Rubygems installed for 1.9 in /usr/lib. Bundler is correct that you're running it on the wrong version of ruby. On Fri, May 31, 2013 at 4:12 PM, Ian Chilton notifications@github.com
|
Yeah, but is that bundler or rbenv!? |
Bundler is a .rb file and has absolutely no control or say over what ruby interpreter is reading that file and running the code. Your system environment is what determines that. On Fri, May 31, 2013 at 5:45 PM, Ian Chilton notifications@github.com
|
Yes, but it's Bundler that's doing the version check and erroring. Also, I just removed rbenv and tried chruby and ruby-install - and it's doing the exact same thing as rbenv and ruby-build.
$ ruby -v $ gem env
$ echo $PATH $ which ruby $ which rake |
Yes, Bundler is doing the version check and erroring. If you remove the |
Ok, thanks for at least replying this far. |
Found the problem.... i'm shelling out to the heroku command in the rake task - which comes from Heroku Toolbelt. However, at the top of /usr/bin/heroku is this shebang:
and sure enough:
So that makes sense - except why is bundler complaining? - where does bundler come in when a rake task is calling that executable? What would you advise as the best fix? - I don't want to change /usr/bin/heroku as that's written by their toolbelt installer and will get upgraded from time to time. Do I need to prefix the call in the rake task with something to send it through rbenv/bundler? I'm just using backticks ( Thanks, Ian |
For reference sake I suspect this issue is |
As the docs mention, you need to use Bundler.with_clean_env{ On Fri, May 31, 2013 at 10:35 PM, Fletcher Nichol
|
Yep, that fixed it! :) Changed the shell out to: Thanks guys. |
Just in case anyone else is searching this issue. I had the same problem using rvm. I was also running rake tasks and shelling out to heroku toolbelt and getting this error: Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0 The same fix worked for me, wrapping the shell commands with (example):
|
I, too, had this issue with rvm and shelling out to Heroku. This fixed it. @ichilton, thanks so much for getting to the bottom of it! |
I'm trying to run a rake task on a rails app, and am getting this error:
As you can see from the paths in the error though, I am running 2.0.0:
$ ruby -v
ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-linux]
$ bundle -v
Bundler version 1.3.5
$ gem env
RubyGems Environment:
The text was updated successfully, but these errors were encountered: