bundle exec rake assets:预编译 - 保持失败 [英] bundle exec rake assets:precompile - keeps failing

查看:148
本文介绍了bundle exec rake assets:预编译 - 保持失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过nitrious.io将我的应用部署到heroku。当我尝试使用git来提交到heroku时,它会一直失败。我搜查了很多,尝试了很多不同的东西,但都没有成功。一个有希望的角度是运行bundle exec(因为这是推向heroku失败的地方),然后尝试投入到heroku。这是我运行bundle exec时的输出,我不知道错误在哪里。任何帮助都是极好的。第一个是第一次运行,第二个代码块是跟踪。


 > action @ markruby-146191:〜/ workspace / learn-rails(master *)$ bundle exec 
>耙子资产:预编译
>耙子中止了!
> NoMethodError:未定义的方法`configure'用于
> #< LearnRails ::应用: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
> `< class中的block(2 levels):Engine>'
> /home/action/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.8/lib/rails/engine.rb:590:in
> `每个'
> /home/action/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.8/lib/rails/engine.rb:590:in
> `在< class中嵌入:引擎>'
> /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
> `跑'
> /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
> `每个'
> /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
> `初始化!'
> /home/action/workspace/learn-rails/config/environment.rb:5:in`< top
> (必填)>'


这是我使用时的输出跟踪

  /home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4。 2 / lib / rake / task.rb:235:在`each'
/home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4.2/lib/rake/ task.rb:235:在`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:在`mon_synchronize'
/home/action/.rvm/gems/ruby-2.0.0-p576/gems/rake-10.4 .2 / lib / rake / task.rb:172:在`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:在'每个'
/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:在`mon_synchronize'
/home/action/.rvm/gems/ruby-2.0.0- p576 / gems / rake-10.4.2 / lib / rake / task.rb:172:在`invoke_with_call_cha '
/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:在'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/ gem / ruby​​-2.0.0-p576 / gems / rake-10.4.2 / lib / rake / application.rb:115:在`run_with_threads'
/home/action/.rvm/gems/ruby-2.0。 0-p576 / gems / rake-10.4.2 / lib / rake / application.rb:100:在`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:'run'
/home/action/.rvm/gems/ruby- 2.0.0-p576 /宝石/耙10.4.2 /斌/耙: 33:在< 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:在< main>'
/home/action/.rvm/gems/ruby-2.0.0- p576 / bin / ruby​​_executable_hooks:15:在`eval'
/home/action/.rvm/gems/ruby-2.0.0-p576/bin/ruby_executable_hooks:15:in`< main>'

Development.rb

  Rails.application.configure do 
#这里指定的设置优先于config / application.rb中的设置。

#在开发环境中,您的应用程序的代码每次请求都会重新加载到
#上。这会减慢响应时间,但对于开发
#来说是完美的,因为当您更改代码时不必重新启动Web服务器。
config.cache_classes = false

#在启动时不要急于加载代码。
config.eager_load = false

#显示完整的错误报告并禁用缓存。
config.consider_all_requests_local = true
config.action_controller.perform_caching = false

#不在乎邮件程序是否无法发送。
config.action_mailer.raise_delivery_errors = false

#将弃用声明打印到Rails记录器。
config.active_support.deprecation =:log

#如果存在挂起的迁移,则在页面加载时引发错误。
config.active_record.migration_error =:page_load

#调试模式禁用了资源的连接和预处理。
#此选项可能会导致视图渲染出现明显延迟,并带有大量
#个复杂资产。
config.assets.debug = true
config.action_mailer.smtp_settings = {
地址:smtp.gmail.com,
端口:587,
域名: ENV [DOMAIN_NAME],
身份验证:plain,
enable_starttls_auto:true,
user_name:ENV [GMAIL_USERNAME],
密码:ENV [GMAIL_PASSWORD]
}
#以开发模式发送电子邮件。
config.action_mailer.perform_deliveries = true

#在运行时为资产提供额外的错误检查。
#检查不正确声明的链轮依赖关系。
#引发有用的错误消息。
config.assets.raise_runtime_errors = true

#提示缺少翻译错误
#config.action_view.raise_on_missing_translations = true
end


$ p

Application.rb

  require File .expand_path('../ boot',__FILE__)

require'rails / all'

#需要Gemfile中列出的宝石,包括任何宝石
#您仅限于:测试,:开发或:生产。
Bundler.require(* Rails.groups)

module LearnRails
class Application< Rails :: Application
#config / environments / *中的设置优先于这里指定的设置。
#应用程序配置应该放入config / initializers中的文件
# - 该目录中的所有.rb文件都会自动加载。

#将Time.zone默认设置为指定区域,并将Active Record自动转换为该区域。
#运行rake -D time获取查找时区名称的任务列表。默认是UTC。
#config.time_zone ='中央时间(美国和加拿大)'

#默认语言环境是:en,并且所有来自config / locales / *。rb,yml的翻译都是自动加载的。
#config.i18n.load_path + = Dir [Rails.root.join('my','locales','*。{rb,yml}')。to_s]
#config.i18n。 default_locale =:de

#对于Foundation 5
#config.assets.precompile + =%w(vendor / modernizr)
config.assets.initialize_on_precompile = false


end
end


解决方案

在你的intializers / development.rb和intializers / production.rb中更改行Rails.application.configure到LearnRails :: Application.configure

在environment.rb中更改这一个 Rails.application.initialize!与LearnRails :: Application.initialize!

在application.rb中添加/取消注释config.assets.enabled = true

I'm trying to deploy my app to heroku through nitrious.io. It keeps failing when i try to use git to commit to 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. This is the output when i run the bundle exec and i don't know enough to figure out where the error is. 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

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

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"
In environment.rb change this one "Rails.application.initialize!" with "LearnRails::Application.initialize!"
Add/uncomment "config.assets.enabled = true" in application.rb

这篇关于bundle exec rake assets:预编译 - 保持失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆