我将项目从rails 3.2升级到rails 4.2。在本地,服务器,测试,预编译资产中一切正常。
但是当我将其部署到生产环境时,我在assets:precompile
时收到此错误。我在当地尝试过,它运作正常。
NameError: uninitialized constant ActionView::Helpers::ActiveModelHelper
/home/app/ryeboy/shared/bundle/ruby/2.0.0/gems/actionview-4.2.4/lib/action_view/helpers.rb:40:in `<module:Helpers>'
/home/app/ryeboy/shared/bundle/ruby/2.0.0/gems/actionview-4.2.4/lib/action_view/helpers.rb:4:in `<module:ActionView>'
/home/app/ryeboy/shared/bundle/ruby/2.0.0/gems/actionview-4.2.4/lib/action_view/helpers.rb:3:in `<top (required)>'
/home/app/ryeboy/shared/bundle/ruby/2.0.0/gems/actionview-4.2.4/lib/action_view/base.rb:5:in `<top (required)>'
/home/app/ryeboy/shared/bundle/ruby/2.0.0/gems/actionview-4.2.4/lib/action_view/view_paths.rb:1:in `<top (required)>'
/home/app/ryeboy/shared/bundle/ruby/2.0.0/gems/actionpack-4.2.4/lib/abstract_controller/rendering.rb:4:in `<top (required)>'
/home/app/ryeboy/shared/bundle/ruby/2.0.0/gems/actionpack-4.2.4/lib/action_controller/base.rb:204:in `<class:Base>'
/home/app/ryeboy/shared/bundle/ruby/2.0.0/gems/actionpack-4.2.4/lib/action_controller/base.rb:164:in `<module:ActionController>'
/home/app/ryeboy/shared/bundle/ruby/2.0.0/gems/actionpack-4.2.4/lib/action_controller/base.rb:5:in `<top (required)>'
/home/app/ryeboy/shared/bundle/ruby/2.0.0/gems/cancancan-1.13.1/lib/cancan/controller_additions.rb:394:in `<top (required)>'
/home/app/ryeboy/shared/bundle/ruby/2.0.0/gems/cancancan-1.13.1/lib/cancan.rb:5:in `require'
/home/app/ryeboy/shared/bundle/ruby/2.0.0/gems/cancancan-1.13.1/lib/cancan.rb:5:in `<top (required)>'
/home/app/ryeboy/shared/bundle/ruby/2.0.0/gems/cancancan-1.13.1/lib/cancancan.rb:1:in `require'
/home/app/ryeboy/shared/bundle/ruby/2.0.0/gems/cancancan-1.13.1/lib/cancancan.rb:1:in `<top (required)>'
/home/app/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
/home/app/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/home/app/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
/home/app/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
/home/app/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
/home/app/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
/home/app/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'
/home/app/ryeboy/releases/20151024080811/config/application.rb:5:in `<top (required)>'
/home/app/ryeboy/releases/20151024080811/Rakefile:5:in `require'
/home/app/ryeboy/releases/20151024080811/Rakefile:5:in `<top (required)>'
我可以看到ActionView::Helpers::ActiveModelHelper
下的/home/app/ryeboy/shared/bundle/ruby/2.0.0/gems/actionview-4.2.4/lib/action_view/helpers/
文件,我尝试在lib/action_view/helpers.rb:40
include ActiveSupport::Benchmarkable
include ActiveModelHelper # this line.
include AssetTagHelper
include AssetUrlHelper
然后错误变为NameError: uninitialized constant ActionView::Helpers::AssetTagHelper
。所以我认为这可能是一些加载序列问题。不幸的是,我无法想出一种调试方法。请帮忙。
顺便说一句,我使用的是ruby 2.0.0,在服务器中使用rvm。
感谢您的帮助:p
答案 0 :(得分:0)
我的RVM配置出了问题。我设置了一个新服务器并直接安装ruby。一切正常......