简体   繁体   English

Heroku:由于gem文件而导致推送失败

[英]Heroku: push failing due to gem file

I have a very simple application that I am trying to push to Heroku and having issues. 我有一个非常简单的应用程序,试图将其推送到Heroku并遇到问题。 I don't have any special Gems installed and doing nothing special, but keep getting an error parsing my Gemfile . 我没有安装任何特殊的Gems,也没有做任何特殊的事情,但是在解析我的Gemfile一直出错。

I have seen examples adding Gem 'rails_12factor' defining Bundler version, Ruby version, updating bundler, updating system. 我看到了一些示例,这些示例添加了Gem'rails_12factor'来定义Bundler版本,Ruby版本,更新捆绑程序,更新系统。 The error doesn't change after doing any of these fixes. 完成任何这些修复后,该错误不会更改。 I installed with RailsInstaller recently, so I am running current versions of everything. 我最近安装了RailsInstaller,所以我正在运行所有版本的当前版本。

Here is my Gemfile : 这是我的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. 您无需在Heroku上安装bundler ,而且我不确定即使在开发中,它在您的Gemfile中有多大帮助。 If you don't have Bundler, how will you run bundle install in the first place? 如果您没有Bundler,那么首先如何运行bundle install

Try taking bundler out of your Gemfile (and Gemfile.lock ), then redeploy. 尝试从您的Gemfile (和Gemfile.lock )中取出bundler ,然后重新部署。

My problem was that I was using an older version of Ruby that was not compatible with Heroku. 我的问题是我使用的是与Heroku不兼容的旧版Ruby。 I installed the latest version of Ruby, and rebuilt my app. 我安装了最新版本的Ruby,并重建了我的应用程序。 I was then able to push to Heroku successfully. 然后,我得以成功推送到Heroku。

A pretty simple thing to catch really, but the error message wasn't totally helpful. 确实很简单,但是错误消息并不完全有用。

Anywho, thanks! 任何人,谢谢!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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