[英]bundle exec rake assets:precompile - keeps failing
I'm trying to deploy my app to heroku through nitrious.io. 我正在尝试通过nitroious.io将应用程序部署到heroku。 It keeps failing when i try to use git to commit to heroku. 当我尝试使用git提交到heroku时,它一直失败。 I have searched a lot and tried a lot of different things and none work. 我搜索了很多东西,尝试了很多不同的东西,但没有任何效果。 One promising angle was running the bundle exec (as that's where the roll out to heroku fails) first and then trying to commit to heroku. 一个有前途的角度是首先运行bundle exec(这是向heroku推出失败的原因),然后尝试提交给heroku。 This is the output when i run the bundle exec and i don't know enough to figure out where the error is. 这是我运行bundle exec时的输出,但我不知道该错误在哪里。 Any help would be awesome. 任何帮助都是极好的。 The first one is the first run, the second block of code is with the trace. 第一个是第一次运行,第二个代码块是带有跟踪的。
> action@markruby-146191:~/workspace/learn-rails(master*)$ bundle exec > rake assets:precompile > rake aborted! > NoMethodError: undefined method `configure' for > #<LearnRails::Application:0x00000004b8ce88> /home/action/workspace/learn-rails/config/environments/development.rb:1:in > `<top (required)>' > /home/action/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in > `require' > /home/action/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in > `block in require' > /home/action/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:214:in > `load_dependency' > /home/action/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in > `require' > /home/action/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.8/lib/rails/engine.rb:591:in > `block (2 levels) in <class:Engine>' > /home/action/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.8/lib/rails/engine.rb:590:in > `each' > /home/action/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.8/lib/rails/engine.rb:590:in > `block in <class:Engine>' > /home/action/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.8/lib/rails/initializable.rb:30:in > `instance_exec' > /home/action/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.8/lib/rails/initializable.rb:30:in > `run' > /home/action/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.8/lib/rails/initializable.rb:55:in > `block in run_initializers' > /home/action/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.8/lib/rails/initializable.rb:44:in > `each' > /home/action/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.8/lib/rails/initializable.rb:44:in > `tsort_each_child' > /home/action/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.8/lib/rails/initializable.rb:54:in > `run_initializers' > /home/action/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.8/lib/rails/application.rb:215:in > `initialize!' > /home/action/workspace/learn-rails/config/environment.rb:5:in `<top > (required)>'
This is the output when i use the trace 这是我使用跟踪时的输出
/home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/action/.rvm/rubies/ruby-2.0.0-p576/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4.2/lib/rake/task.rb:201:in `block in invoke_prerequisites'
/home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4.2/lib/rake/task.rb:199:in `each'
/home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4.2/lib/rake/task.rb:199:in `invoke_prerequisites'
/home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4.2/lib/rake/task.rb:178:in `block in invoke_with_call_chain'
/home/action/.rvm/rubies/ruby-2.0.0-p576/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/home/action/.rvm/gems/ruby-2.0.0-p576/bin/rake:23:in `load'
/home/action/.rvm/gems/ruby-2.0.0-p576/bin/rake:23:in `<main>'
/home/action/.rvm/gems/ruby-2.0.0-p576/bin/ruby_executable_hooks:15:in `eval'
/home/action/.rvm/gems/ruby-2.0.0-p576/bin/ruby_executable_hooks:15:in `<main>'
Development.rb Development.rb
Rails.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
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: ENV["DOMAIN_NAME"],
authentication: "plain",
enable_starttls_auto: true,
user_name: ENV["GMAIL_USERNAME"],
password: ENV["GMAIL_PASSWORD"]
}
# Send email in development mode.
config.action_mailer.perform_deliveries = true
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
Application.rb application.rb中
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module LearnRails
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# For Foundation 5
#config.assets.precompile += %w( vendor/modernizr )
config.assets.initialize_on_precompile = false
end
end
In your intializers/development.rb and intializers/production.rb change line "Rails.application.configure" to "LearnRails::Application.configure" 在您的intializers / development.rb和intializers / production.rb中,将“ Rails.application.configure”行更改为“ LearnRails :: Application.configure”
In environment.rb change this one "Rails.application.initialize!" 在environment.rb中,将其更改为“ Rails.application.initialize!”。 with "LearnRails::Application.initialize!" 通过“ LearnRails :: Application.initialize!”
Add/uncomment "config.assets.enabled = true" in application.rb 在application.rb中添加/取消注释“ config.assets.enabled = true”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.