无法推进Heroku

时间:2013-10-20 13:07:27

标签: heroku ruby-on-rails-4

当推送到Heroku时,使用命令“git push heroku master”我遇到了这些错误:

预编译资产失败。 推送拒绝,无法编译Ruby / Rails应用程序。

我很难找到纠正这个问题的方法 - 任何想法?

$ git push heroku master
Counting objects: 284, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (261/261), done.
Writing objects: 100% (284/284), 62.35 KiB | 0 bytes/s, done.
Total 284 (delta 100), reused 0 (delta 0)

-----> Ruby/Rails app detected
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.3.2
       New app detected loading default bundler cache
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
       Fetching gem metadata from https://rubygems.org/..........
       Fetching gem metadata from https://rubygems.org/..
       Fetching git://github.com/thomas-mcdonald/bootstrap-sass.git
       Using rake (10.1.0)
       Using i18n (0.6.5)
       Using minitest (4.7.5)
       Installing multi_json (1.8.2)
       Using atomic (1.1.14)
       Using thread_safe (0.1.3)
       Installing tzinfo (0.3.38)
       Using activesupport (4.0.0)
       Using builder (3.1.4)
       Using erubis (2.7.0)
       Using rack (1.5.2)
       Using rack-test (0.6.2)
       Using actionpack (4.0.0)
       Using mime-types (1.25)
       Using polyglot (0.3.3)
       Using treetop (1.4.15)
       Using mail (2.5.4)
       Using actionmailer (4.0.0)
       Using activemodel (4.0.0)
       Using activerecord-deprecated_finders (1.0.3)
       Using arel (4.0.0)
       Using activerecord (4.0.0)
       Installing bcrypt-ruby (3.1.2)
       Installing sass (3.2.12)
       Using bootstrap-sass (3.0.0.0) from git://github.com/thomas-mcdonald/bootstrap-sass.git (at 3)
       Using coffee-script-source (1.6.3)
       Installing execjs (2.0.2)
       Using coffee-script (2.2.0)
       Using thor (0.18.1)
       Using railties (4.0.0)
       Installing coffee-rails (4.0.1)
       Installing orm_adapter (0.4.0)
       Installing warden (1.2.3)
       Installing devise (3.1.1)
       Using hike (1.2.3)
       Installing jbuilder (1.5.2)
       Using jquery-rails (3.0.4)
       Installing json (1.8.1)
       Using pg (0.17.0)
       Using bundler (1.3.2)
       Using tilt (1.4.1)
       Using sprockets (2.10.0)
       Installing sprockets-rails (2.0.1)
       Using rails (4.0.0)
       Using rails_serve_static_assets (0.0.1)
       Installing rails_stdout_logging (0.0.3)
       Using rails_12factor (0.0.2)
       Using rdoc (3.12.2)
       Installing sass-rails (4.0.1)
       Using sdoc (0.3.20)
       Using turbolinks (1.3.0)
       Using uglifier (2.2.1)
       Your bundle is complete! It was installed into ./vendor/bundle
       Bundle completed (24.92s)
       Cleaning up the bundler cache.
       Removing sass-rails (3.2.6)
       Removing puma (2.6.0)
       Removing execjs (2.0.1)
       Removing arel (3.0.2)
       Removing rack-ssl (1.3.3)
       Removing activemodel (3.2.14)
       Removing coffee-rails (3.2.2)
       Removing journey (1.0.4)
       Removing rails (3.2.14)
       Removing coffee-rails (4.0.0)
       Removing sass (3.2.10)
       Removing raindrops (0.12.0)
       Removing pg (0.16.0)
       Removing nokogiri (1.6.0)
       Removing multi_json (1.8.0)
       Removing mini_portile (0.5.1)
       Removing rails_stdout_logging (0.0.2)
       Removing json (1.8.0)
       Removing unicorn (4.6.3)
       Removing tzinfo (0.3.37)
       Removing actionpack (3.2.14)
       Removing activeresource (3.2.14)
       Removing sprockets (2.2.2)
       Removing sass-rails (4.0.0)
       Removing builder (3.0.4)
       Removing actionmailer (3.2.14)
       Removing railties (3.2.14)
       Removing rack-cache (1.2)
       Removing bcrypt-ruby (3.0.1)
       Removing kgio (2.8.1)
       Removing jbuilder (1.5.1)
       Removing sprockets-rails (2.0.0)
       Removing activesupport (3.2.14)
       Removing rack (1.4.5)
       Removing activerecord (3.2.14)
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       rake aborted!
       undefined local variable or method `config' for main:Object
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/config/environments/production.rb:83:in `<top (required)>'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:591:in `block (2 levels) in <class:Engine>'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:590:in `each'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:590:in `block in <class:Engine>'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:44:in `each'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:44:in `tsort_each_child'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/config/environment.rb:5:in `<top (required)>'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:249:in `block in run_tasks_blocks'
       /tmp/build_5569ec14-f1a7-4b83-aad0-121447c4ec1c/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:54:in `block (2 levels) in define'
       Tasks: TOP => environment
       (See full trace by running task with --trace)
 !
 !     Precompiling assets failed.
 !

 !     Push rejected, failed to compile Ruby/Rails app

To git@heroku.com:mappd.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:mappd.git'

Production.rb文件(内容)

Mappd::Application.configure do

  config.cache_classes = true

  config.eager_load = true

  config.consider_all_requests_local       = false

  config.action_controller.perform_caching = true

  config.serve_static_assets = false

  config.assets.js_compressor = :uglifier

  config.assets.compile = false

  config.assets.digest = true

  config.assets.version = '1.0'


  config.log_level = :info

  config.i18n.fallbacks = true

  config.active_support.deprecation = :notify

  config.log_formatter = ::Logger::Formatter.new
end

config.action_mailer.default_url_options = { :host => '#' }

development.rb的内容

Mappd::Application.configure do
  # Settings specified here will take precedence over those in config/application.rb.

  # In the development environment your application's code is reloaded on
  # every request. This slows down response time but is perfect for development
  # since you don't have to restart the web server when you make code changes.
  config.cache_classes = false

  # Do not eager load code on boot.
  config.eager_load = false

  # Show full error reports and disable caching.
  config.consider_all_requests_local       = true
  config.action_controller.perform_caching = false

  # Don't care if the mailer can't send.
  config.action_mailer.raise_delivery_errors = false

  # Print deprecation notices to the Rails logger.
  config.active_support.deprecation = :log

  # Raise an error on page load if there are pending migrations
  config.active_record.migration_error = :page_load

  # Debug mode disables concatenation and preprocessing of assets.
  # This option may cause significant delays in view rendering with a large
  # number of complex assets.
  config.assets.debug = true

#Required for Heroku
  config.action_mailer.default_url_options = { :host => 'localhost:3000' }
end

2 个答案:

答案 0 :(得分:1)

以下一行:

config.action_mailer.default_url_options = { :host => '#' }

位于configure文件的production.rb块之外

必须在里面:

Mappd::Application.configure do

  # config exists only here

  config.action_mailer.default_url_options = { :host => '#' }
end

答案 1 :(得分:0)

在development.rb中检查是否存在以下块:

YourApplicationName::Application.configure do
   config.active_support.deprecation = :log
   config.cache_classes = false
end

其中'YourApplicationName'是rails应用程序的名称。

相关问题