Search code examples
ruby-on-railsrubyherokubundlebundler

push rails app to heroku fails in bundle supports no platform


when I push my rails-app to heroku it fails at the bundling step because it doesn't match the platform. I tried to change or remove the ruby tag from Gemfile but it doesn't change anything. It fails because my bundle does not support any platform [] (guess should be ruby in there).

git push heroku master
Counting objects: 19, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (17/17), done.
Writing objects: 100% (19/19), 2.96 KiB | 0 bytes/s, done.
Total 19 (delta 5), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby
remote: -----> Using Ruby version: ruby-2.3.7
remote: -----> Installing dependencies using bundler 1.15.2
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        Your bundle only supports platforms [] but your local platforms are ["ruby",
remote:        "x86_64-linux"], and there's no compatible match between those two lists.
remote:        Bundler Output: Your bundle only supports platforms [] but your local platforms are ["ruby",
remote:        "x86_64-linux"], and there's no compatible match between those two lists.
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to evening-brushlands-95986.
remote:
To https://git.heroku.com/evening-brushlands-95986.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/evening-brushlands-95986.git'

On my local machine it satisfies the platform

bundle platform
Your platform is: x86_64-linux

Your app has gems that work on these platforms:
* ruby

Your Gemfile specifies a Ruby version requirement:
* ruby 2.5.0p0

Your current platform satisfies the Ruby version requirement.

Even if I specify a ruby 2.5 in my Gemfile, heroku uses ruby-2.3.7

my Gemfile:

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.5'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.0'
# Use postgresql as the database for Active Record
gem 'pg', '>= 0.18', '< 2.0'
# Use Puma as the app server
gem 'puma', '~> 3.11'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'mini_racer', platforms: :ruby

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  # gem 'byebug', platforms: [:ruby, :mri, :mingw, :x64_mingw]
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 2.15', '< 4.0'
  gem 'selenium-webdriver'
  # Easy installation and use of chromedriver to run system tests with Chrome
  gem 'chromedriver-helper'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
# gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem 'administrate', '~> 0.10.0'
gem 'data-confirm-modal', '~> 1.6.2'
gem 'devise', '~> 4.4.3'
gem 'devise-bootstrapped', github: 'excid3/devise-bootstrapped', branch: 'bootstrap4'
gem 'devise_masquerade', '~> 0.6.0'
gem 'font-awesome-sass', '~> 4.7'
gem 'gravatar_image_tag', github: 'mdeering/gravatar_image_tag'
gem 'jquery-rails', '~> 4.3.1'
gem 'bootstrap', '~> 4.0.0.beta'
gem 'mini_magick', '~> 4.8'
gem 'webpacker', '~> 3.4'
gem 'sidekiq', '~> 5.0'
gem 'foreman', '~> 0.84.0'
gem 'omniauth-facebook', '~> 4.0'
gem 'omniauth-twitter', '~> 1.4'
gem 'omniauth-github', '~> 1.3'
gem 'whenever', require: false
gem 'friendly_id', '~> 5.1.0'
gem 'sitemap_generator', '~> 6.0', '>= 6.0.1'

anyone had this before?

regards Kai


Solution

  • @toy I think some of the gem dependencies problems. Either you can remove the Gemfile.lock and do bundle install then commit and push or do bundle update then commit and push along with the Gemfile.lock

    1) Remove Gemfile.lock
    2) bundle install
    3) git add Gemfile.lock
    4) git commit -m 'Gemfile.lock added'
    5) git push heroku master
    

    OR

    1) bundle update
    2) git add Gemfile.lock
    3) git commit -m 'Gemfile.lock added'
    4) git push heroku master