I followed every step in here:
I have this in my gem file
ruby "1.9.3"
and then when I deploy heroku says:
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-1.9.3
-----> Installing dependencies using 1.5.2
Then when I do
heroku run "ruby -v"
I still get
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
Then I added a path:
heroku config:set PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
Deployed again, and still same result:
I tried:
heroku config:set PATH=bin:vendor/bundle/ruby/1.9.3/bin:/usr/local/bin:/usr/bin:/bin
Still no use:
In my heroku Log I get this:
/app/vendor/bundle/ruby/1.9.1/gems/bundler-1.5.2/lib/bundler/definition.rb:390:in `validate_ruby!': Your Ruby version is 1.9.2, but your Gemfile specified 1.9.3 (Bundler::RubyVersionMismatch)
It kind of is driving me nuts, I can't get Heroku to use 1.9.3.
I looked at the following questions as well:
Ruby version is not upgrading on Heroku
Is it possible to run my Rails app on Heroku with Ruby 1.9.3? If so, how?
How can I choose Ruby version on Heroku?
Heroku cedar doesn't upgrade to ruby-1.9.3
Still can't get anywhere
After a very painful search by removing and adding stuff from my most recent commit I realized that a file .bash_profile was added to my Rails Root app that had this in it:
export PGHOST=localhost
export PATH=/usr/local/bin:$PATH
So I just removed that, because this calls up the path to the Ruby version, the default one.
I hope no one ends up making same mistake.
Related
Hello I have a little problem, I push my project (Rails) normally on github without any problem I connect it normally to heroku and when I try to do git heroku push master, it displays this to me =>
enter image description here
I saw that this is a gemfile problem, because a friend's gemfile.lock is working on my project when I try to upload
RAILS : Rails 5.2.4.5
BUNDLER : Bundler version 2.2.14
RUBY : ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin20]
Since the problem is with bundle install, have you done all what is expected with heroku like using the gem pg instead of sqlite3?
The Ruby on Rails Tutorial by Michael Hartl uses a Gemfile without specifying a Ruby version: the ruby keyword is missing in all the applications.
When I deploy to Heroku I receive the following warning:
remote: ###### WARNING:
remote: You have not declared a Ruby version in your Gemfile.
remote: To set your Ruby version add this line to your Gemfile:
remote: ruby '2.2.4'
remote: # See https://devcenter.heroku.com/articles/ruby-versions for more information.
The tutorial says that "the costs associated with including such an explicit Ruby version number outweigh the (negligible) benefits, so you should ignore this warning for now. The main issue is that keeping your sample app and system in sync with the latest Ruby version can be a huge inconvenience".
I am wondering whether the alternative is to keep the pace with the Ruby version at Heroku (presumably 2.2.4 at present), as the book seems to suggest, or also to specify any Ruby version it suits me. In other words, since I am using Ruby 2.2.1p85 for my application, adding ruby "2.2.1", :patchlevel => "85" would work and make Heroku adjust to this version or rather I am supposed to adjust to Heroku and add as suggested ruby '2.2.4'?
I am using rvm and a specific gemset with a specific Ruby version, for no other reason than trying to use an environment as much close to the tutorial as possible. What is the best practice in a real context? Would you suggest to use the last Ruby version and include it in the Gemfile? Can the Gemfile leave out the Ruby version with no worries?
Please follow the steps to solve
You can check which ruby version is associate with your app by command
heroku run "ruby -v"
It is good to have default version of ruby which is 2.2.4 in order to solve your problem. If your ruby version is older than 2.2.4 then please upgrade it.
after checking/upgrading version You can use the ruby keyword in your app’s Gemfile to specify a particular version of Ruby.
source "https://rubygems.org"
ruby "2.2.4"
You will need to install and update bundler again
$ gem install bundler
$ bundle update
This command:
heroku run rake db:migrate
solved same problem
I'm having major issues with the heroku toolbelt. I'm using the cedar 14 stack and when I am trying to use a ruby version that isn't ruby 2.0.0-dev I get this error.
rbenv: heroku: command not found
The `heroku' command exists in these Ruby versions:
2.0.0-dev
I need heroku to be working with ruby 1.9.3 and I don't think cedar 14 supports that version of ruby. Can someone explain first, why I am only allowed to use heroku with ruby 2.0.0-dev and also how I can install a older stack that supports ruby 1.9.3?
The problem is that there are two heroku executables on your system: one in system paths such as /usr/local/bin/heroku (provided by Toolbelt), and one in rbenv's shims because Ruby 2.0.0-dev had "heroku" gem installed.
Because rbenv's shims directory usually have higher precedence, it will block invocation from ever executing the heroku executable provided by Toolbelt.
The solution is to uninstall any instance of "heroku" gem and relying solely on Toolbelt for all heroku usage on the command line:
for v in `rbenv whence heroku`; do RBENV_VERSION=$v gem uni heroku -ax; done
rbenv rehash
which heroku
You can use 1.9.3 on the cedar stack according to this. The heroku toolbelt is installed as a executable not a ruby gem. How are you trying to execute the command? You should be able to use it from the terminal such as heroku run rake db:migrate etc.
After upgrading a Rails application to use Ruby 2.0.0 (from 1.9.3), I started receiving this error when attempting to deploy to Heroku via rake <stage> deploy.
Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0 (Bundler::RubyVersionMismatch)
It also seems to cause this error, (but I can run the Heroku commands manually without the heroku_san helpers, so authorization is not the issue).
Expected(200) <=> Actual(401 Unauthorized)
I updated the gems to the latest version, and also updated the Heroku Toolbelt.
I found this pull request and patched my version, but the error persisted.
How do I solve this (on both Ubuntu & OSX)?
Other info:
Ubuntu 12.04 LTS x64
Rails 3.2.13
Ruby 2.0.0-p247
heroku-api-0.3.15
heroku_san-4.0.8
heroku-toolbelt/2.41.0 (x86_64-linux)
rvm 1.22.10
The solution for me on Ubuntu was to modify
/usr/local/heroku/bin/heroku
And change the shebang line to
#!/usr/bin/env ruby
Thanks goes to Pivotal Labs for this.
(I don't use a Mac.)
Another issue I found with this error (1.9.2 not 1.9.3) is having BUNDLE_GEMFILE env variable set on heroku which causes heroku ruby build pack to freak and default to 1.9.2.
I tried this tip: https://github.com/thoughtbot/laptop/pull/14#issuecomment-3192270 .
On deploy I see
-----> Using RUBY_VERSION: ruby-1.9.3-p0
But my logs show the environment variable is not respected
INFO ruby 1.9.2 (2011-07-09) [x86_64-linux]
Hacky / experimental solutions accepted!
Edit: I am on the cedar stack.
Here's an update for everyone referencing this question... Heroku now allows you to specify your ruby version in your Gemfile, thanks to their addition to the latest version of bundler.
First run:
gem install bundler --pre
then add ruby '1.9.3' to your Gemfile as such.
source 'http://rubygems.org'
ruby '1.9.3'
gem 'rails', '3.2.3'
The full release from Heroku with details is at http://blog.heroku.com/archives/2012/5/9/multiple_ruby_version_support_on_heroku/
Right, so Ruby 1.9.3 is definitely possibly. As you said hacky/experimental solutions were accepted - this is definitely one of them.
It's actually really simple;
Enable Heroku Labs's user_env_compile feature for your application.
Set a heroku config variable to RUBY_VERSION to ruby-1.9.3-p0 (heroku config:add RUBY_VERSION=ruby-1.9.3-p0)
ENSURE that the heroku PATH config variable has bin at the front (heroku config:add PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin)
When you next deploy you should see your application using 1.9.3 - the deployment output will show this too;
-> Heroku receiving push
-----> Ruby/Rails app detected
-----> Using RUBY_VERSION: ruby-1.9.3-p0
-----> Installing dependencies using Bundler version 1.1.rc.7
Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment
Since May 10 it is possible to use Ruby 1.9.3 in an easier way. Just take a look at Heroku's blog:
http://blog.heroku.com/archives/2012/5/9/multiple_ruby_version_support_on_heroku/
I was able to get a Rails 3.2 app running on Ruby 1.9.3-p0 on Heroku cedar today
I followed the steps on
http://railsapps.github.com/rails-heroku-tutorial.html
ran into a problem locally with 1.9.3 and openssl
but was able to get an app deployed and working
http://mccaffrey-rails32-193.herokuapp.com
no Procfile
thin and pg in Gemfile
I added some debug output so you can see the rails and ruby version info
Its crazy that a basic rails app slug size is 28.9MB!
I had the same problem: Specifying 1.9.3 in my Gemfile, but it was using 1.9.2. This fixed it:
heroku config:add PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
According to the Heroku Cedar stack definition here Cedar currently only supports MRI 1.9.2. Have you tried contacting Heroku support? They're generally pretty responsive.
Edit: it's possible to 'fool' the platform sometimes into running some binaries such as running Haskell on Heroku so if you're feeling really dedicated you might be able to package something up. I imagine this isn't too easy with MRI though.