简体   繁体   中英

Heroku: push failing due to gem file

I have a very simple application that I am trying to push to Heroku and having issues. I don't have any special Gems installed and doing nothing special, but keep getting an error parsing my Gemfile .

I have seen examples adding Gem 'rails_12factor' defining Bundler version, Ruby version, updating bundler, updating system. The error doesn't change after doing any of these fixes. I installed with RailsInstaller recently, so I am running current versions of everything.

Here is my Gemfile :

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end

ruby '~> 2.3.3'
gem 'bundler', '~> 2.0.2'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.7'
# Use Puma as the app server
gem 'puma', '~> 3.7'
# 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 'therubyracer', platforms: :ruby

# Use CoffeeScript for .coffee assets and viewrubys
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 Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug',  '11.0.1'

  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 2.15'
  gem 'selenium-webdriver'

  # Use sqlite3 as the database for Active Record
  gem "sqlite3", "~> 1.3.6"

end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
end

group :production do
  gem 'pg'
  gem 'rails_12factor'
end

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

This the error I am gettting:

$ git push herokustaging master
Enumerating objects: 300, done.
Counting objects: 100% (300/300), done.
Delta compression using up to 8 threads
Compressing objects: 100% (275/275), done.
Writing objects: 100% (300/300), 59.91 KiB | 1.50 MiB/s, done.
Total 300 (delta 96), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote:  !     Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
remote:                         Detected buildpacks: Ruby,Node.js
remote:                         See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote:
remote:  !
remote:  !     There was an error parsing your Gemfile, we cannot continue
remote:  !     /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/vendor/ruby/heroku-18/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
remote:  !     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/vendor/ruby/heroku-18/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path'
remote:  !     from /tmp/d20190618-120-vf683l/bundler-2.0.1/bin/bundle:23:in `<main>'
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to sojournsb.

The relevant part of the error message appears to be

can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)

You shouldn't need to install bundler on Heroku, and I'm not sure how helpful it is to have in your Gemfile even in development. If you don't have Bundler, how will you run bundle install in the first place?

Try taking bundler out of your Gemfile (and Gemfile.lock ), then redeploy.

My problem was that I was using an older version of Ruby that was not compatible with Heroku. I installed the latest version of Ruby, and rebuilt my app. I was then able to push to Heroku successfully.

A pretty simple thing to catch really, but the error message wasn't totally helpful.

Anywho, thanks!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM