gpt4 book ai didi

ruby-on-rails - "config.cache_classes = true"没有要加载的文件 --/path-to-app/app/config/environment (LoadError)

转载 作者:行者123 更新时间:2023-12-04 18:20:26 26 4
gpt4 key购买 nike

应用程序不会在 config.cache_classes 设置为 true 的生产模式下启动。它在堆栈跟踪中给出以下错误:

    $ bundle exec rails s -e production
/home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:304:in `rescue in depend_on': No such file to load -- /path-to-app/app/config/environment (LoadError)
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:299:in `depend_on'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:216:in `require_dependency'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/engine.rb:138:in `block (2 levels) in eager_load!'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/engine.rb:137:in `each'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/engine.rb:137:in `block in eager_load!'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/engine.rb:135:in `each'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/engine.rb:135:in `eager_load!'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/application.rb:108:in `eager_load!'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/application/finisher.rb:41:in `block in <module:Finisher>'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/initializable.rb:25:in `instance_exec'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/initializable.rb:25:in `run'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/initializable.rb:50:in `block in run_initializers'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/initializable.rb:49:in `each'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/initializable.rb:49:in `run_initializers'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/application.rb:134:in `initialize!'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/application.rb:77:in `method_missing'
from /path-to-app/config/environment.rb:5:in `<top (required)>'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `block in require'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `load_dependency'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
from /path-to-app/config.ru:3:in `block in <main>'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/builder.rb:46:in `instance_eval'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/builder.rb:46:in `initialize'
from /path-to-app/config.ru:1:in `new'
from /path-to-app/config.ru:1:in `<main>'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/builder.rb:35:in `eval'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/builder.rb:35:in `parse_file'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/server.rb:162:in `app'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/server.rb:253:in `wrapped_app'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/server.rb:204:in `start'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands/server.rb:65:in `start'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands.rb:30:in `block in <top (required)>'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands.rb:27:in `tap'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

奇怪的是它在关闭缓存的情况下工作正常。我的 production.rb 文件看起来像

App::Application.configure do

config.cache_classes = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.action_dispatch.x_sendfile_header = "X-Sendfile"
config.action_mailer.delivery_method = :sendmail
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.serve_static_assets = false
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
config.action_dispatch.best_standards_support = :builtin
end

我正在使用以下 gem:

source 'http://rubygems.org'

gem 'rails', '3.0.7'

gem 'mysql2', '0.2.1'

gem 'carrierwave'

gem 'rmagick'

gem "capistrano-ext"

gem 'rake', '0.8.7'

group :development do

gem 'rspec-rails', '2.1.0'

gem 'ruby-debug19'

gem 'wirble'

end

group :test do

gem 'ruby-debug19'

gem 'rspec', '2.1.0'

gem 'webrat', '0.7.1'

gem 'factory_girl_rails', '1.0'

end
gem 'thinking-sphinx', '2.0.3'

非常感谢任何帮助

最佳答案

我知道,我在做一些愚蠢的事情(虽然这不是我的全部,同样的老设计师故事。我应该检查 git 提交)。我在应用程序目录和项目目录中也有 spec 文件夹。但我仍然很困惑为什么它可以与

config.cache_classes = false

在 production.rb 中。

关于ruby-on-rails - "config.cache_classes = true"没有要加载的文件 --/path-to-app/app/config/environment (LoadError),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7107154/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com