Skip to content

Wrong ruby version used in rake tasks #118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lyahdav opened this issue Dec 21, 2012 · 15 comments
Closed

Wrong ruby version used in rake tasks #118

lyahdav opened this issue Dec 21, 2012 · 15 comments
Labels

Comments

@lyahdav
Copy link

lyahdav commented Dec 21, 2012

After upgrading from heroku_san 3.0.4 to 4.0.7, now running any of the heroku_san rake tasks gives this error:
Your Ruby version is 1.8.7, but your Gemfile specified 1.9.3 (Bundler::RubyVersionMismatch)
My Gemfile does specify ruby 1.9.3. I have RVM installed and I'm doing this is in a project configured to use ruby 1.9.3-p327. I'm on OS X 10.8.2. My guess is this is somehow related to the changes in the heroku_san gem to use the Heroku toolbelt instead of the deprecated Heroku gem. I'm guessing the Heroku toolbelt is using my system ruby even though I have RVM configured with ruby 1.9.3 as the default. Any ideas?

@iamnader
Copy link

+1 !

@kmayer
Copy link
Contributor

kmayer commented Jan 21, 2013

Have you tried removing the heroku gem? I've seen some reports that the gem is interfering with the toolbelt. Anyway, I'll try writing some tests to replicate it. If you could send me

  • Gemfile.lock
  • output from gem list -l
  • output from rvm info

That would help!

Thanks

@lyahdav
Copy link
Author

lyahdav commented Jan 22, 2013

I managed to fix this by doing 2 things:

  1. Remove the old heroku gem.
  2. Reinstall the Heroku Toolbelt so that it would use ruby 1.9.3 instead of ruby 1.8.7. I'm not sure how the Toolbelt installation works, but I'm guessing when I installed it months ago my default RVM ruby was 1.8.7 and later I upgraded to 1.9.3.

Perhaps something should be added to the readme about upgrading. Thanks!

@kmayer
Copy link
Contributor

kmayer commented Jan 22, 2013

This has happened a few times, I'll see if I can write some tests around it.

@runlevel5
Copy link

This happen again with me when I use ruby 2.0.0 for my app, I got this:

Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0
Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0
rake aborted!
Command failed with status (18): [heroku run rake db:migrate --app swiny]
/Users/macbookair/.rvm/gems/ruby-2.0.0-p0/bundler/gems/heroku_san-c6d1f484b351/lib/heroku_san/stage.rb:149:in `sh_heroku'
/Users/macb

@kmayer
Copy link
Contributor

kmayer commented Mar 17, 2013

We haven't worked on ruby v2 support, yet. I'll leave this issue open as a
placeholder for that work.

On Sun, Mar 17, 2013 at 1:07 AM, Trung Lê [email protected] wrote:

This happen again with me when I use ruby 2.0.0 for my app, I got this:

Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0
Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0
rake aborted!
Command failed with status (18): [heroku run rake db:migrate --app swiny]
/Users/macbookair/.rvm/gems/ruby-2.0.0-p0/bundler/gems/heroku_san-c6d1f484b351/lib/heroku_san/stage.rb:149:in `sh_heroku'
/Users/macb


Reply to this email directly or view it on GitHubhttps://github.com//issues/118#issuecomment-15019026
.

@nycvotes-dev
Copy link

It looks to us like the Heroku Toolbelt has its own bundled Ruby 1.9.3. When our Gemfile specifies 2.0.0, we get the error.

So it appears that something is locally running the Heroku Toolbelt ruby and loading the application Gemfile. When these rubies don't match in version, you get the error.

Seems like there shouldn't ever be a situation where we want to load the local Gemfile using the local Heroku Toolbelt ruby instead of the usual locally installed ruby.

@nycvotes-dev
Copy link

We traced it to the system() call here: https://github.com/fastestforward/heroku_san/blob/master/lib/heroku_san/stage.rb#L153

It looks like when you call heroku version from here, the ruby inside of Heroku Toolbelt decides to load bundler and the Gemfile. But when we run heroku version directly from our Bash prompt instead, it doesn't touch the Gemfile at all.

@kmayer
Copy link
Contributor

kmayer commented Apr 11, 2013

[sigh]

That's kind of a fail if the toolbelt can't be scripted from inside another
ruby script that was launched with a different ruby.

It's also a possible conflict with the rvm/bundler integration.

I'll try to contact David Dollar at Heroku and see what he thinks we should
do.

On Thu, Apr 11, 2013 at 9:09 AM, nycvotes-dev [email protected]:

We traced it to the system() call here:
https://github.com/fastestforward/heroku_san/blob/master/lib/heroku_san/stage.rb#L153

It looks like when you call heroku version from here, the ruby inside of
Heroku Toolbelt decides to load bundler and the Gemfile. But when we run heroku
version directly from our Bash prompt instead, it doesn't touch the
Gemfile at all.


Reply to this email directly or view it on GitHubhttps://github.com//issues/118#issuecomment-16244443
.

Ken Mayer | Global Village Idiot
[email protected] | (808) 722-6142 (c)

@aaronjensen
Copy link

if you run heroku like this it will work it seems:

system "env -i HOME=$HOME bash  -c 'heroku --version'"

@jkamenik
Copy link

I have a slightly different solution to the problem, which I list in issue #138. Instead of executing bash with a clear ENV I just unset the offending ENV variables and pass that along with the system call.

@aaronjensen
Copy link

This is definitely a less invasive method. I found I actually need to include TERM too or I get warnings. It probably makes sense to do it the way you are describing.

@jphenow
Copy link

jphenow commented Jun 3, 2013

Bundler.with_clean_env or Bundler.clean_exec for piped stuff (log tail)

@talyric
Copy link

talyric commented Oct 2, 2013

I was experiencing this error and found this issue, but I was not able to solve the problem with the information here. Later I found a solution (work-around?). See http://stackoverflow.com/questions/19056267/error-using-heroku-san-gem-your-ruby-version-is-x-x-x-but-your-gemfile-specifi/19056268#19056268
I hope this helps until this issue is resolved.

@kmayer
Copy link
Contributor

kmayer commented Oct 22, 2013

Closed by #155

@kmayer kmayer closed this as completed Oct 22, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants