Lately I upgraded my rails app from Rails 3 to Rails 5 and from Bootstrap 2 to Bootstrap 4 and after solving it all I am having some trouble uploading it to Heroku. I mean, in local it works perfectly with rails server
. But when I have tried to upload it I get an error and I can’t find any similar case on the Internet. This is what I get after git push heroku master
:
Counting objects: 122, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (119/119), done.
Writing objects: 100% (122/122), 31.05 KiB | 1.48 MiB/s, done.
Total 122 (delta 77), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: Your app was upgraded to bundler 1.15.2.
remote: Previously you had a successful deploy with bundler 1.5.2.
remote:
remote: If you see problems related to the bundler version please refer to:
remote: https://devcenter.heroku.com/articles/bundler-version
remote: -----> Using Ruby version: ruby-1.9.2
remote: ###### WARNING:
remote: Removing `Gemfile.lock` because it was generated on Windows.
remote: Bundler will do a full resolve so native gems are handled properly.
remote: This may result in unexpected gem versions being used in your app.
remote: In rare occasions Bundler may not be able to resolve your dependencies at all.
remote: https://devcenter.heroku.com/articles/bundler-windows-gemfile
remote:
remote: -----> Installing dependencies using bundler 1.15.2
remote: Purging Cache. Changing stack from cedar to cedar-14
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4
remote: Fetching gem metadata from https://rubygems.org/........
remote: Fetching version metadata from https://rubygems.org/..
remote: Fetching dependency metadata from https://rubygems.org/.
remote: Resolving dependencies...
remote: The latest bundler is 1.16.0, but you are currently running 1.15.2.
remote: To update, run `gem install bundler`
remote: Bundler could not find compatible versions for gem "rubygemsils (= 5.1.4) was resolved to 5.1.4, which depends on
remote: rubygems Bundler Output: Fetching gem metadata from https://rubygems.org/........
remote: Fetching version metadata from https://rubygems.org/..
remote: Fetching dependency metadata from https://rubygems.org/.
remote: Resolving dependencies...
remote: The latest bundler is 1.16.0, but you are currently running 1.15.2.
remote: To update, run `gem install bundler`
remote: Bundler could not find compatible versions for gem "rubygemsresolved to 5.1.4, which depends on
remote: rubygems ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to keepmefit.
remote:
I know it complains about my bundler version but it should be a warning and not a real error. I guess the problem must be in one of the gems that may not be compatible with Heroku or Rails 5 now but they give no problem on local server. Here’s my Gemfile:
source 'https://rubygems.org'
gem 'rails', '5.1.4'
if RUBY_VERSION =~ /1.9/
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
end
group :development, :test do
gem 'sqlite3'
gem 'activemodel'
gem 'json'
gem 'rspec-rails'
gem 'guard-rspec'
gem 'rb-notifu'
end
# Heroku uses PostreSQL
group :production do
gem 'pg'
end
group :test do
gem 'capybara'
gem 'factory_girl_rails', '4.1.0'
gem 'launchy'
end
group :development do
gem 'annotate'
gem 'better_errors'
gem 'binding_of_caller'
gem 'meta_request'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails'
gem 'coffee-rails'
gem 'coffee-script-source', '1.8.0'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
#gem 'bcrypt-ruby'
gem 'bcrypt', '~> 3.1.11', platforms: [:ruby, :x64_mingw, :mingw]
# HTML abstraction language (Haml)
gem 'haml'
gem 'haml-rails'
# Twitter Bootstrap
gem 'bootstrap-sass'
require 'rbconfig'
gem 'wdm', '>= 0.1.0' if RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i
# HMTL 5 support
gem 'modernizr-rails'
# More icons!
#gem "font-awesome-rails"
# http://rubydoc.info/gems/bootstrap-datepicker-rails/1.0.0.7/frames
gem 'bootstrap-datepicker-rails'
gem 'tzinfo-data'
# Sample data
gem 'faker', '1.1.2'
# Pagination
gem 'will_paginate', '~> 3.1.0'
gem 'bootstrap-will_paginate'
# Turbolinks https://github.com/rails/turbolinks#turbolinks
# http://railscasts.com/episodes/390-turbolinks
gem 'turbolinks'
gem 'jquery-turbolinks'
# https://github.com/rails/strong_parameters
# gem 'strong_parameters'
# http://railscasts.com/episodes/314-pretty-urls-with-friendlyid?view=asciicast
gem 'friendly_id'
# http://railscasts.com/episodes/324-passing-data-to-javascript?view=asciicast
gem 'gon'
gem 'cloudinary'
As one of the answers point, I have tried too with git pull heroku master
and it returns:
From https://git.heroku.com/keepmefit
* branch master -> FETCH_HEAD
* [new branch] master -> heroku/master
Already up-to-date.
Also git push -f heroku master
and the output is the same as using git push heroku master
so the error is still there and the push is rejected.
Any help is appreciated.
2
Answers
It looks like you heroku remote is conflicting with the files you are trying to push (after your upgrade). You have two options
1 – Clean / merge up with your new changes the heroku remote and push again
git pull heroku master
git push heroku master
2 – Force push your new changes
NOTE: THIS ACTION WILL OVERRIDE WHAT YOU CURRENTLY HAVE IN HEROKU. So make sure that you dont need any changes that are already on heroku.
git push -f heroku master
It seems that the stack (cedar-14 or cedar) is a really old one. Upgrading the stack to Heroku-16 will solve the issue.