我正在尝试通过nitrious.io将我的应用部署到heroku。当我尝试使用git提交到heroku时它会一直失败。我经常搜索并尝试了很多不同的东西而且都没有用。一个有希望的角度是运行bundle exec(因为这是推出到heroku的地方失败),然后尝试提交到heroku。这是我运行bundle exec时的输出,我不知道该错误在哪里。任何帮助都是极好的。第一个是第一个运行,第二个代码块是跟踪。
> 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)>'
这是我使用跟踪
时的输出/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
答案 0 :(得分:0)
在你的intializers / development.rb和intializers / production.rb中更改行&#34; Rails.application.configure&#34; to&#34; LearnRails :: Application.configure&#34;
在environment.rb中更改这个&#34; Rails.application.initialize!&#34;与&#34; LearnRails :: Application.initialize!&#34;
添加/取消注释&#34; config.assets.enabled = true&#34;在application.rb