我試圖在生產模式與本地運行:軌道 - 正在運行的生產模式在本地=沒有這樣的文件來加載 - 配置/環境
$ RAILS_ENV=production rails s
,但我得到:
/home/durrantm/.rvm/gems/[email protected]/gems/activesupport-3.1.8/li
b/active_support/dependencies.rb:306:in `rescue in depend_on': No such file
to load -- /home/durrantm/Dropnot/webs/rails_apps/linker/app/assets/../con
fig/environment (LoadError)
我可以創建一個全新的導軌3.1.8
應用程序和做RAILS_ENV=production rails server
,我不明白這個問題。
我還可以做rails s
並運行在開發模式服務器罰款沒有錯誤。
我還可以做RAILS_ENV=development rails s
並運行在開發模式服務器罰款沒有錯誤。
FWIW,我的應用程序本來是一個軌道2.3
應用程序,所以也許我缺少一個已經添加或更改軌道的東西嗎?
我確實有config
目錄與environment.rb
文件。或許它被引用的方式在某種程度上是錯誤的?
我加config.assets.enabled = true
到config/application.rb
但它沒有幫助(沒想到它是因爲這是資產編譯,但它是我發現的差異!)。
完全跟蹤:
[email protected]:~/Dropnot/webs/rails_apps/linker/config/environments (v3.1.8_with_assets)
$ RAILS_ENV=production rails s
=> Booting WEBrick
=> Rails 3.1.8 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/durrantm/.rvm/gems/[email protected]/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:306:in `rescue in depend_on': No such file to load -- /home/durrantm/Dropnot/webs/rails_apps/linker/app/assets/../config/environment (LoadError)
from /home/durrantm/.rvm/gems/[email protected]/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:301:in `depend_on'
from /home/durrantm/.rvm/gems/[email protected]/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:214:in `require_dependency'
from /home/durrantm/.rvm/gems/[email protected]/gems/railties-3.1.8/lib/rails/engine.rb:417:in `block (2 levels) in eager_load!'
from /home/durrantm/.rvm/gems/[email protected]/gems/railties-3.1.8/lib/rails/engine.rb:416:in `each'
from /home/durrantm/.rvm/gems/[email protected]/gems/railties-3.1.8/lib/rails/engine.rb:416:in `block in eager_load!'
from /home/durrantm/.rvm/gems/[email protected]/gems/railties-3.1.8/lib/rails/engine.rb:414:in `each'
from /home/durrantm/.rvm/gems/[email protected]/gems/railties-3.1.8/lib/rails/engine.rb:414:in `eager_load!'
from /home/durrantm/.rvm/gems/[email protected]/gems/railties-3.1.8/lib/rails/application/finisher.rb:51:in `block in <module:Finisher>'
from /home/durrantm/.rvm/gems/[email protected]/gems/railties-3.1.8/lib/rails/initializable.rb:30:in `instance_exec'
from /home/durrantm/.rvm/gems/[email protected]/gems/railties-3.1.8/lib/rails/initializable.rb:30:in `run'
from /home/durrantm/.rvm/gems/[email protected]/gems/railties-3.1.8/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/durrantm/.rvm/gems/[email protected]/gems/railties-3.1.8/lib/rails/initializable.rb:54:in `each'
from /home/durrantm/.rvm/gems/[email protected]/gems/railties-3.1.8/lib/rails/initializable.rb:54:in `run_initializers'
from /home/durrantm/.rvm/gems/[email protected]/gems/railties-3.1.8/lib/rails/application.rb:96:in `initialize!'
from /home/durrantm/.rvm/gems/[email protected]/gems/railties-3.1.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config/environment.rb:5:in `<top (required)>'
from /home/durrantm/.rvm/gems/[email protected]/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:240:in `require'
from /home/durrantm/.rvm/gems/[email protected]/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:240:in `block in require'
from /home/durrantm/.rvm/gems/[email protected]/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /home/durrantm/.rvm/gems/[email protected]/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /home/durrantm/.rvm/gems/[email protected]/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:223:in `load_dependency'
from /home/durrantm/.rvm/gems/[email protected]/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:240:in `require'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config.ru:4:in `block in <main>'
from /home/durrantm/.rvm/gems/[email protected]/gems/rack-1.3.6/lib/rack/builder.rb:51:in `instance_eval'
from /home/durrantm/.rvm/gems/[email protected]/gems/rack-1.3.6/lib/rack/builder.rb:51:in `initialize'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config.ru:1:in `new'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config.ru:1:in `<main>'
from /home/durrantm/.rvm/gems/[email protected]/gems/rack-1.3.6/lib/rack/builder.rb:40:in `eval'
from /home/durrantm/.rvm/gems/[email protected]/gems/rack-1.3.6/lib/rack/builder.rb:40:in `parse_file'
from /home/durrantm/.rvm/gems/[email protected]/gems/rack-1.3.6/lib/rack/server.rb:200:in `app'
from /home/durrantm/.rvm/gems/[email protected]/gems/railties-3.1.8/lib/rails/commands/server.rb:46:in `app'
from /home/durrantm/.rvm/gems/[email protected]/gems/rack-1.3.6/lib/rack/server.rb:301:in `wrapped_app'
from /home/durrantm/.rvm/gems/[email protected]/gems/rack-1.3.6/lib/rack/server.rb:252:in `start'
from /home/durrantm/.rvm/gems/[email protected]/gems/railties-3.1.8/lib/rails/commands/server.rb:70:in `start'
from /home/durrantm/.rvm/gems/[email protected]/gems/railties-3.1.8/lib/rails/commands.rb:54:in `block in <top (required)>'
from /home/durrantm/.rvm/gems/[email protected]/gems/railties-3.1.8/lib/rails/commands.rb:49:in `tap'
from /home/durrantm/.rvm/gems/[email protected]/gems/railties-3.1.8/lib/rails/commands.rb:49:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
東西很奇怪。它正在尋找'app /'目錄內的'config /'目錄。它不應該在那裏看。 –
是的,這是肯定的奇怪的部分... –
可能會導致什麼?這是我幾年來運行良好並通過幾個rails版本升級的應用程序,並沒有遇到類似的情況。我目前正在通過'config /'目錄進行操作(現在我正在通過'initializers /',但還沒有看到任何東西... –