【问题标题】:Problems Deploying a rails app to Heroku将 Rails 应用程序部署到 Heroku 的问题
【发布时间】:2011-10-03 05:16:24
【问题描述】:

我在将 Rails 应用程序部署到 Heroku 时遇到问题,我什至无法运行 Heroku 控制台! (见下文我从终端得到的响应)

总的来说,我对 Rails 和编程很陌生,所以我不太明白这里的问题是什么,非常感谢一些帮助!

/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:239:in `require':  /app/config/environments/production.rb:3: unknown regexp options - lcal (SyntaxError)
  from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:239:in `block in require'
  from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:225:in `block in load_dependency'
  from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:596:in `new_constants_in'
  from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:225:in `load_dependency'
  from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:239:in `require'
  from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.8/lib/rails/application/bootstrap.rb:11:in `block in <module:Bootstrap>'
  from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.8/lib/rails/initializable.rb:25:in `instance_exec'
  from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.8/lib/rails/initializable.rb:25:in `run'
  from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.8/lib/rails/initializable.rb:50:in `block in run_initializers'
  from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.8/lib/rails/initializable.rb:49:in `each'
  from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.8/lib/rails/initializable.rb:49:in `run_initializers'
  from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.8/lib/rails/application.rb:134:in `initialize!'
  from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.8/lib/rails/application.rb:77:in `method_missing'
  from /app/config/environment.rb:7:in `<top (required)>'
  from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:239:in `require'
  from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:239:in `block in require'
  from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:225:in `block in load_dependency'
  from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:596:in `new_constants_in'
  from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:225:in `load_dependency'
  from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:239:in `require'
  from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.8/lib/rails/application.rb:103:in `require_environment!'
  from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.8/lib/rails/commands.rb:22:in `<top (required)>'
  from script/rails:6:in `require'
  from script/rails:6:in `<main>'

这里是 config/environments./production.rb,我注释掉了第 3 行,因为我认为这可能是问题所在,但无论是注释、取消注释还是完全删除,我都会遇到同样的问题!

Pingpong::Application.configure do

# /opt/local/bin/convert


# Settings specified here will take precedence over those in config/application.rb

# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true

# Full error reports are disabled and caching is turned on
config.consider_all_requests_local       = false
config.action_controller.perform_caching = true

# Specifies the header that your server uses for sending files
config.action_dispatch.x_sendfile_header = "X-Sendfile"

# For nginx:
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'

# If you have no front-end server that supports something like X-Sendfile,
# just comment this out and Rails will serve the files

# See everything in the log (default is :info)
# config.log_level = :debug

# Use a different logger for distributed setups
# config.logger = SyslogLogger.new

# Use a different cache store in production
# config.cache_store = :mem_cache_store

# Disable Rails's static asset server
# In production, Apache or nginx will already do this
config.serve_static_assets = false

# Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"

# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false

# Enable threaded mode
# config.threadsafe!

# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true

# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
end

/app/config/环境

# Load the rails application
require File.expand_path('../application', __FILE__)



# Initialize the rails application
Pingpong::Application.initialize!

【问题讨论】:

  • 感谢道格拉斯,有什么想法!?
  • 你能发布 config/environments/production.rb 吗?
  • 第 3 行如果未注释会导致您的原始问题,因为这是 Ruby 中的正则表达式。如果已注释,您将不会收到该错误。那么 new 错误是什么?
  • 嗨,Ryan,不管是评论、取消评论还是删除,我仍然遇到同样的问题!在堆栈跟踪中,它还提到 /app/config/environment 中的第 7 行,我也会将该代码添加到问题中!

标签: ruby-on-rails-3 deployment error-handling heroku stack-trace


【解决方案1】:

问题出在第 3 行。确保您已提交更改,然后将它们推送到 Heroku。

【讨论】:

    猜你喜欢
    • 2016-08-27
    • 1970-01-01
    • 1970-01-01
    • 2015-12-25
    • 2019-04-20
    • 2016-01-06
    • 2017-12-05
    • 2016-07-24
    • 1970-01-01
    相关资源
    最近更新 更多