首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Heroku无法通过bundler安装gem发布错误

Heroku无法通过bundler安装gem发布错误
EN

Stack Overflow用户
提问于 2015-01-18 12:13:56
回答 1查看 199关注 0票数 0

我正在尝试通过heroku使用Publify gem托管一个RoR应用程序。然而,我一直收到以下错误。我已经按照Publify的github页面上关于heroku和https://github.com/publify/publify的说明进行了操作。另一件有趣的事情是,它在我自己的服务器(rails s)上运行得很好,这表明gemfile中的环境出了问题。

提前感谢您的帮助。

以下是我收到的错误(heroku推送):

代码语言:javascript
复制
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

因为这个问题是由我的gemfile引起的,

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

发布于 2015-01-18 19:50:03

看起来你想要使用的Gemfile部分,也就是if ENV["HEROKU"]代码块并没有被执行。相反,将调用else块,该块将在您发布的日志片段中引发错误。

有几种可能的原因,我将按概率顺序写下来

如果您没有按照publify documentation

  • heroku achieve

  • something
  • 环境变量中的说明进行设置,则您正在使用的自定义构建包会干扰您尝试使用的构建包,否则heroku config:set HEROKU=true is

就会损坏

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28007069

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档