openshift上的rails控制台
我将rails应用程序部署到openshift它运行良好,但我无法在生产服务器上运行’rails console’。 它给了我这个错误。 我怎么解决这个问题? 我试图更新rubygems,但它也给出了权限被拒绝的错误,我也做不到。
rails c错误:
Warning: You're using Rubygems 1.8.24 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance. /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require': cannot load such file -- bundler/setup (LoadError) from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require' from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/commands.rb:33:in `' from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/commands.rb:4:in `' from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require' from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require' from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/application.rb:77:in `preload' from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/application.rb:140:in `serve' from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/application.rb:128:in `block in run' from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/application.rb:122:in `loop' from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/application.rb:122:in `run' from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/application/boot.rb:18:in `' from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require' from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require' from -e:1:in `'
rubygems-update错误:
[appname.rhcloud.com repo]\> update_rubygems ERROR: While executing gem ... (Errno::EACCES) Permission denied - /opt/rh/ruby193/root/usr/local/share/ruby
我遇到了同样的问题,尝试像这样运行:
RAILS_ENV=production bundle exec rails console
还要确保在运行它时在〜/ app-root / repo中运行它
要更新rubygems:
gem update --system
如果这不能解决问题,请尝试Spring的建议并运行:
gem pristine --all
问题是有多个bundle可执行文件,而系统使用的是错误的。
找到正确的bundle
可执行文件。 在我的情况下,它位于~/.gem/bin/bundle
。
如果找不到,请安装gem install bundler
。
然后在~/app-root/repo
运行~/.gem/bin/bundle exec rails console production
在OpenShift上运行4.1.4 Rails盒式磁带时,我无法获得任何gem install
或bundle exec
解决方案。 我的解决方案是在app-root/repo
运行RAILS_ENV=production bin/rails c
。