簡體   English   中英

Heroku:由於gem文件而導致推送失敗

[英]Heroku: push failing due to gem file

我有一個非常簡單的應用程序,試圖將其推送到Heroku並遇到問題。 我沒有安裝任何特殊的Gems,也沒有做任何特殊的事情,但是在解析我的Gemfile一直出錯。

我看到了一些示例,這些示例添加了Gem'rails_12factor'來定義Bundler版本,Ruby版本,更新捆綁程序,更新系統。 完成任何這些修復后,該錯誤不會更改。 我最近安裝了RailsInstaller,所以我正在運行所有版本的當前版本。

這是我的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]

這是我得到的錯誤:

$ 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.

錯誤消息的相關部分似乎是

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

您無需在Heroku上安裝bundler ,而且我不確定即使在開發中,它在您的Gemfile中有多大幫助。 如果您沒有Bundler,那么首先如何運行bundle install

嘗試從您的Gemfile (和Gemfile.lock )中取出bundler ,然后重新部署。

我的問題是我使用的是與Heroku不兼容的舊版Ruby。 我安裝了最新版本的Ruby,並重建了我的應用程序。 然后,我得以成功推送到Heroku。

確實很簡單,但是錯誤消息並不完全有用。

任何人,謝謝!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM