Precompile failing on Heroku with initialize_on_precompile set to false

你离开我真会死。 提交于 2019-12-10 17:55:27

问题


I have an app I'm trying to deploy to Heroku's cedar stack.

During the precompile phase of the deploy, I get the error:

Your bundle is complete! It was installed into ./vendor/bundle
       Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       rake aborted!
       could not connect to server: Connection refused
       Is the server running on host "127.0.0.1" and accepting
       TCP/IP connections on port 5432?
       Tasks: TOP => environment
       (See full trace by running task with --trace)
       Precompiling assets failed, enabling runtime asset compilation

Usually I can fix this by adding

config.assets.initialize_on_precompile = false

to config/initializers/production.rb as described in the Heroku docs.

This time it doesn't seem to be fixing the issue though. What else can I try?

Here's my Gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.7'

gem 'jquery-rails'
gem 'mini_magick'
gem 'fog'
gem 'carrierwave'
gem 'mail_form'
gem 'client_side_validations'
gem 'remotipart', '~> 1.0'
gem 'thin'

group :production do
  gem 'pg'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

group :development do
  gem 'heroku'
  gem 'mailcatcher'
end

group :development, :test do
  gem 'rspec-rails'
  gem 'sqlite3'
end

group :test do
  gem 'capybara-webkit'
  gem 'database_cleaner'
  gem 'factory_girl_rails'
  gem 'database_cleaner'
end

回答1:


Have you tried this Heroku labs fix?

https://devcenter.heroku.com/articles/labs-user-env-compile

Just came across it recently, and haven't had a chance to try, but will do so next time asset compilation invariably fails...

There's also a blog post on it here:

http://blog.genuitytech.com/2012/01/31/heroku-labs-and-user-env-compile/



来源:https://stackoverflow.com/questions/11889131/precompile-failing-on-heroku-with-initialize-on-precompile-set-to-false

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!