Ruby on rails &引用;config.cache_classes=true";没有要加载的此类文件--/path到app/app/config/environment(LoadError)
当config.cache\u classes设置为true时,应用程序不会在生产模式下启动。它给出了stacktrace的以下错误:Ruby on rails &引用;config.cache_classes=true";没有要加载的此类文件--/path到app/app/config/environment(LoadError),ruby-on-rails,caching,memcached,production-environment,Ruby On Rails,Caching,Memcached,Production Environment,当config.cache\u classes设置为true时,应用程序不会在生产模式下启动。它给出了stacktrace的以下错误: $ 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
$ 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>'
我正在使用以下宝石:
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提交)。我在app目录和project目录中都有spec文件夹。但我还是不明白为什么它能用
config.cache_classes = false
在production.rb.中,如果您尝试“rails s-e生产”,您会得到什么结果?我得到了相同的结果,问题无论如何都会得到解决。你还是可以帮忙的。看看我的答案。
config.cache_classes = false