Shimol Khan
Shimol Khan

Reputation: 83

Heroku: Failed to install gems via Bundler in Rails 6 on MacOS during pushing to Heroku

I am trying to push my rails 6 (6.1.3.1) app on heroku using Git. I am using heroku CLI. In development everything is okay but getting this error each and every time I am trying to push the app to heroku. I updated bundler, reproduced gemfile.lock, then committed to github. But still getting this error after git push heroku master

Here is my Gemfile

 source 'https://rubygems.org'
 git_source(:github) { |repo| "https://github.com/#{repo}.git" }
 ruby '3.0.1'
 gem 'rails', '~> 6.1.3', '>= 6.1.3.1'
 gem 'pg', '~> 1.2', '>= 1.2.3'
 gem 'puma', '~> 5.0'
 gem 'sass-rails', '>= 6'
 gem 'webpacker', '~> 5.0'
 gem 'turbolinks', '~> 5'
 gem 'jbuilder', '~> 2.7'
 gem 'bootsnap', '>= 1.4.4', require: false
 group :development, :test do
   gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
 end
 group :development do
   gem 'web-console', '>= 4.1.0'
   gem 'rack-mini-profiler', '~> 2.0'
   gem 'listen', '~> 3.3'
   gem 'spring'
 end
 group :test do
   gem 'capybara', '>= 3.26'
   gem 'selenium-webdriver'
   gem 'webdrivers'
 end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'dotenv-rails', '~> 2.7', '>= 2.7.6'

Output in Terminal: Terminal

Heroku Build Log:

-----> Building on the Heroku-20 stack
-----> Determining which buildpack to use for this app
!Warning: Multiple default buildpacks reported the ability to handle this app. The first 
buildpack in the list below will be used.
        Detected buildpacks: Ruby,Node.js
        See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
-----> Ruby app detected
-----> Installing bundler 2.2.16
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-3.0.1
-----> Installing dependencies using bundler 2.2.16
   Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle 
   BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
   Your bundle only supports platforms ["x86_64-darwin-17"] but your local platform
   is x86_64-linux. Add the current platform to the lockfile with `bundle lock
   --add-platform x86_64-linux` and try again.
   Bundler Output: Your bundle only supports platforms ["x86_64-darwin-17"] but your local 
   platform
   is x86_64-linux. Add the current platform to the lockfile with `bundle lock
   --add-platform x86_64-linux` and try again.
  !
  !     Failed to install gems via Bundler.
  !
  !     Push rejected, failed to compile Ruby app.
  !     Push failed

My Ruby version is 3.0.1 and I am using MacOS High Sierra 10.13.6

Please help me

Upvotes: 1

Views: 315

Answers (1)

Shimol Khan
Shimol Khan

Reputation: 83

I have successfully figured out the issue. The issue was platform. So I run this two commands and fixed this:

bundle lock --add-platform ruby
bundle lock --add-platform x86_64-linux

Upvotes: 3

Related Questions