简体   繁体   English

Heroku无法通过Publify的捆绑程序错误安装gems

[英]Heroku Failed to Install gems via bundler error with Publify

I am trying to host a RoR app with Publify gem via heroku. 我正在尝试通过heroku托管带有Publify gem的RoR应用程序。 However I keep getting the following error. 但是我一直收到以下错误。 I have followed the instructions on Publify's github page concerning heroku, https://github.com/publify/publify . 我遵循了关于Heroku的Publify github页面上的指示, https://github.com/publify/publify Another interesting thing is that it runs perfectly on my own server (rails s), signalling that something is wrong with the environment in the gemfile. 另一个有趣的事情是,它可以在我自己的服务器(rails)上完美运行,表明gemfile中的环境有问题。

Thanks in advance for your help. 在此先感谢您的帮助。

Here are the errors I am receiving (heroku push) : 这是我收到的错误(heroku push):

Your version of git is 1.9.3. Which has serious security vulnerabilities.
More information here: https://blog.heroku.com/archives/2014/12/23/update_your_git_clients_on_windows_and_os_x
Checking for app files to sync... done, 590 files needed
Uploading: 100.0% (ETA: 0s)
Launching build process...  done
Preparing app for compilation... done
Fetching buildpack... done
Detecting buildpack... done, Buildkit+Ruby
Fetching cache... empty
Compiling app...
  Compiling for Ruby
  Compiling Ruby/Rails
sh: Syntax error: Unterminated quoted string
 !
    ERROR: There was an error parsing your Gemfile, we cannot continue
    ERROR: Unfortunately, a fatal error has occurred. Please see the Bundler
    ERROR: troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
    ERROR: /tmp/compile_unHgf/Gemfile:19:in `eval_gemfile': You need to configure config/database.yml first (RuntimeError)
    ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/dsl.rb:36:in `instance_eval'
    ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/dsl.rb:36:in `eval_gemfile'
    ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/dsl.rb:10:in `evaluate'
    ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/definition.rb:26:in `build'
    ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler.rb:153:in `definition'
    ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/cli/platform.rb:10:in `block in run'
    ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/ui/shell.rb:69:in `silence'
    ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/cli/platform.rb:9:in `run'
    ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/cli.rb:358:in `platform'
    ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/vendor/thor/command.rb:27:in `run'
    ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command'
    ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/vendor/thor.rb:363:in `dispatch'
    ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/vendor/thor/base.rb:440:in `start'
    ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/cli.rb:9:in `start'
    ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/bin/bundle:20:in `block in <top (required)>'
    ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
    ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/bin/bundle:20:in `<top (required)>'
    ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/bin/bundle:19:in `load'
    ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/bin/bundle:19:in `<main>'
 !
ERROR: Build failed, exited 1

Since the problem has been caused by the gemfile here is mine, 由于问题是由gemfile引起的,这里是我的,

source 'https://rubygems.org'

if ENV["HEROKU"]
  ruby '2.1.3'

  gem "pg"
  gem "thin" # Change this to another web server if you want (ie. unicorn, passenger, puma...)
  gem "rails_12factor"
else

  require 'yaml'
  env = ENV["RAILS_ENV"] || 'development'
  dbfile = File.expand_path("../config/database.yml", __FILE__)

  unless File.exists?(dbfile)
    if ENV['DB']
      FileUtils.cp "config/database.yml.#{ENV['DB'] || 'postgres'}", 'config/database.yml'
    else
      raise "You need to configure config/database.yml first"
    end
  end

  conf = YAML.load(File.read(dbfile))
  environment = conf[env]
  adapter = environment['adapter'] if environment
  raise "You need define an adapter in your database.yml or set your RAILS_ENV variable" if adapter == '' || adapter.nil?
  case adapter
  when 'sqlite3'
    gem 'sqlite3'
  when 'postgresql'
    gem 'pg'
  when 'mysql2'
    gem 'mysql2'
  else
    raise "Don't know what gem to use for adapter #{adapter}"
  end
end

gem 'rails', '~> 4.1.7'
gem 'htmlentities'
gem 'bluecloth', '~> 2.1'
gem 'coderay', '~> 1.1.0'
gem 'kaminari'
gem 'RedCloth', '~> 4.2.8'
gem 'addressable', '~> 2.1', :require => 'addressable/uri'
gem 'mini_magick', '~> 3.8.1', :require => 'mini_magick'
gem 'uuidtools', '~> 2.1.1'
gem 'flickraw-cached'
gem 'rubypants', '~> 0.2.0'
gem 'rake', '~> 10.3.2'
#gem 'acts_as_list'
#gem 'acts_as_tree_rails3'
gem 'fog'
gem 'recaptcha', :require => 'recaptcha/rails', :branch => 'rails3'
gem 'carrierwave', '~> 0.10.0'
gem 'akismet', '~> 1.0'
gem 'twitter', '~> 5.6.0'

gem "jquery-rails", "~> 3.1.0"
gem "jquery-ui-rails", "~> 5.0.2"

gem 'rails-timeago', '~> 2.0'

gem 'rails_autolink', '~> 1.1.0'
gem 'dynamic_form', '~> 1.1.4'

gem 'non-stupid-digest-assets'

# removed from Rails-core as Rails 4.0
gem 'actionpack-page_caching', '~> 1.0.2'
gem 'rails-observers', '~> 0.1.2'

group :assets do
  gem 'sass-rails', " ~> 4.0.3"
  gem 'coffee-rails', " ~> 4.0.1"
  gem 'uglifier'
end

group :development, :test do
  gem 'thin'
  gem 'factory_girl', '~> 4.5.0'
  gem 'capybara'
  gem 'rspec-rails', '~> 3.1.0'
  gem 'simplecov', :require => false
  gem 'pry-rails'
  gem 'better_errors', '~> 2.0.0'
  gem 'binding_of_caller'
  gem 'guard-rspec'
end

# Install gems from each theme
Dir.glob(File.join(File.dirname(__FILE__), 'themes', '**', "Gemfile")) do |gemfile|
  eval(IO.read(gemfile), binding)
end

it looks like the part of the Gemfile that you want to use aka the if ENV["HEROKU"] block is not being executed. if ENV["HEROKU"]未执行if ENV["HEROKU"]块,则看起来Gemfile使用Gemfile的一部分。 instead, the else block is invoked which raises the error in the snippet of the log you posted. 相反,将调用else块,这会在您发布的日志的代码段中引发错误。

there are several possible causes of this that i'm going to write down in order of probablity 有几种可能的原因,我将按照概率顺序写下来

  • you did not set heroku config:set HEROKU=true as explained in the publify documentation 您没有按照发布文档中的说明设置heroku config:set HEROKU=true
  • heroku ignores the environment variable heroku忽略环境变量
  • the custom build-pack you are using interferes with what you are trying to achieve 您正在使用的自定义构建包会干扰您要实现的目标
  • something else is broken 其他东西坏了

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

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