Reputation: 799
I'm trying to push my app to Heroku, but I can't get past this error:
Delta compression using up to 2 threads.
Compressing objects: 100% (1554/1554), done.
Writing objects: 100% (1652/1652), 23.93 MiB | 369 KiB/s, done.
Total 1652 (delta 859), reused 0 (delta 0)
-----> Ruby/Rails app detected
!
! Invalid RUBY_VERSION specified: There-was-an-error-in-your-Gemfile,-and-Bundler- cannot-continue.
! Valid versions: ruby-2.0.0, ruby-1.9.3, ruby-1.9.2, ruby-1.8.7, ruby-1.9.3-jruby- 1.7.0, ruby-1.8.7-jruby-1.7.0, ruby-1.9.3-jruby-1.7.1, ruby-1.8.7-jruby-1.7.1, ruby-1.9.3-rbx-2.0.0dev, ruby-1.8.7-rbx-2.0.0dev
!
! Push rejected, failed to compile Ruby/Rails app
To [email protected]:myapp.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:myapp.git'
I'm running ruby 1.9.3p448. I followed the steps here, and the top of my Gemfile includes:
source 'http://rubygems.org'
ruby '1.9.3'
gem 'rails', '3.2.13'
When I run "heroku run 'ruby -v'" it returns ruby 1.9.2p290. What's going on?
Edit: Here's my whole Gemfile:
source 'http://rubygems.org'
ruby '1.9.3'
gem 'rails', '3.2.13'
gem 'pg'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'devise'
gem 'nokogiri'
gem 'i18n'
gem 'paperclip'
gem 'kaminari'
gem 'rest-client'
require 'addressable/uri'
group :development do
gem 'better_errors'
end
Upvotes: 3
Views: 699
Reputation: 79723
You have an error in your Gemfile
, in the line require 'addressable/uri'
. You can’t use require
inside a Gemfile
. The load path hasn’t been set up yet, so you get a LoadError
which Bundler catches and produces an error message.
Heroku is trying to use bundle platform --ruby
to determine the version of Ruby you want to use, but is not properly detecting the error condition and treating the error message as the version. This is obviously not a valid version, and so it produces the error you are seeing.
I’m guessing you’re using require
because to use the Addressable gem you need to require either addressable/uri
or addressable/template
(or both) and you can’t just use require 'addressable'
. In this case you can use the :require
option of Bundler:
gem 'addressable', :require => 'addressable/uri'
If you do need to require more than one thing, you can use an array:
gem 'addressable', :require => ['addressable/uri', 'addressable/template']
Upvotes: 4
Reputation: 9577
Just wondering if this changes your situation, as your Gemfile almost looks like mine, but for these changes.
1)Of course, assuming you are in your Rails Root folder and your less Gemfile
is the actual one above. You did also bundle
too after changes.
2) change
source 'https://rubygems.org'
3) optional Heck, try switching version to ruby '2.0.0'
just to get passed it.
4) I think this is needed too:
gem 'rails_12factor'
All these tricks should make it work at least.
EDIT
Why is require 'addressable/uri'
there? remove this and add gem 'addressable'
instead.
Upvotes: 0