在openshift上部署时,未初始化的常量ActionView :: Helpers :: ActiveModelHelper

我试图在openshift上部署我的rails应用程序,但是我得到了这个错误。 Phusion Passenger显示此错误:您已经激活了机架1.5.2,但您的Gemfile需要机架1.6.0。 使用bundle exec可以解决这个问题。 (gem:: LoadError)

remote: uninitialized constant ActionView::Helpers::ActiveModelHelper remote: /var/lib/openshift/54bc0eee5973ca3f54000153/app-root/runtime/repo/vendor /bundle/ruby/gems/actionview-4.2.0/lib/action_view/helpers.rb:40:in `' remote: /var/lib/openshift/54bc0eee5973ca3f54000153/app- root/runtime/repo/vendor /bundle/ruby/gems/actionview-4.2.0/lib/action_view/helpers.rb:4:in `' remote: /var/lib/openshift/54bc0eee5973ca3f54000153/app-root/runtime/repo/vendor /bundle/ruby/gems/actionview-4.2.0/lib/action_view/helpers.rb:3:in `' remote: /var/lib/openshift/54bc0eee5973ca3f54000153/app-root/runtime/repo/vendor /bundle/ruby/gems/actionview-4.2.0/lib/action_view/base.rb:5:in `' remote: /var/lib/openshift/54bc0eee5973ca3f54000153/app-root/runtime/repo/vendor /bundle/ruby/gems/actionview-4.2.0/lib/action_view/view_paths.rb:1:in `' remote: /var/lib/openshift/54bc0eee5973ca3f54000153/app-root/runtime/repo/vendor /bundle/ruby/gems/actionpack-4.2.0/lib/abstract_controller/rendering.rb:4:in `' remote: /var/lib/openshift/54bc0eee5973ca3f54000153/app-root/runtime/repo/vendor /bundle/ruby/gems/actionpack-4.2.0/lib/action_controller/base.rb:204:in `' remote: /var/lib/openshift/54bc0eee5973ca3f54000153/app-root/runtime/repo/vendor /bundle/ruby/gems/actionpack-4.2.0/lib/action_controller/base.rb:164:in `' remote: /var/lib/openshift/54bc0eee5973ca3f54000153/app-root/runtime/repo/vendor /bundle/ruby/gems/actionpack-4.2.0/lib/action_controller/base.rb:5:in `' remote: /var/lib/openshift/54bc0eee5973ca3f54000153/app-root/runtime/repo/vendor /bundle/ruby/gems/responders-2.0.2/lib/responders/controller_method.rb:37:in `' remote: /var/lib/openshift/54bc0eee5973ca3f54000153/app-root/runtime/repo/vendor /bundle/ruby/gems/responders-2.0.2/lib/responders.rb:15:in `' remote: /var/lib/openshift/54bc0eee5973ca3f54000153/app-root/runtime/repo/vendor /bundle/ruby/gems/responders-2.0.2/lib/responders.rb:9:in `' remote: /var/lib/openshift/54bc0eee5973ca3f54000153/app-root/runtime/repo/vendor /bundle/ruby/gems/devise-3.4.1/lib/devise.rb:7:in `' remote: /opt/rh/ror40/root/usr/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require' remote: /opt/rh/ror40/root/usr/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require' remote: /opt/rh/ror40/root/usr/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each' remote: /opt/rh/ror40/root/usr/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require' remote: /opt/rh/ror40/root/usr/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each' remote: /opt/rh/ror40/root/usr/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require' remote: /opt/rh/ror40/root/usr/share/gems/gems/bundler-1.3.5/lib/bundler.rb:132:in `require' remote: /var/lib/openshift/54bc0eee5973ca3f54000153/app-root/runtime/repo/config/application.rb:9:in `' remote: /var/lib/openshift/54bc0eee5973ca3f54000153/app-root/runtime/repo/Rakefile:4:in `require' remote: /var/lib/openshift/54bc0eee5973ca3f54000153/app-root/runtime/repo/Rakefile:4:in `' remote: (See full trace by running task with --trace) remote: Compilation of assets is disabled or assets not detected. remote: Starting Ruby cartridge remote: ------------------------- remote: Git Post-Receive Result: success remote: Activation status: success remote: Deployment completed with status: success To ssh://54bc0eee5973ca3f54000153@livechat-rdemidovapps.rhcloud.com/~/git/livechat.git/ 

actionpack 4.2需要机架〜> 1.6.0。 你的Gemfile可能不包括rack gem。 您可以尝试将此行添加到Gemfile中

 gem 'rack', '~> 1.6.0' 

然后跑

 bundle install 

 git push origin 

这可能会迫使openshift环境使用最新的机架gem。

OpenShift内部依赖于RHEL 6.6 SCL ror40 ,其中包括机架版本1.5.2和乘客4.0.18。 不幸的是,这一切都不能像今天这样更新。

作为开始疑难解答步骤重命名Gemfile.lock(或删除它),然后重新安装捆绑bundle install