ruby-on-rails - openshift 上的 rails 控制台

标签 ruby-on-rails ruby console openshift

我将我的 Rails 应用程序部署到 OpenShift,它运行良好,但我无法在生产服务器上运行“Rails 控制台”。它给了我这个错误。我该如何解决这个问题?我尝试更新 ruby​​gems,但它也给出了权限被拒绝的错误,我也无法做到。

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 `<module:Spring>'
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 `<top (required)>'
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 `<top (required)>'
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 `<main>'

rubygems 更新错误:

[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 中运行它

关于ruby-on-rails - openshift 上的 rails 控制台,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26131728/

相关文章:

ruby TCPSocket : Find out how much data is available

java - System.out.printf() 有没有办法接受变量来设置字段宽度?

javascript - 如何使用 javascript 创建有效的 svg 元素

ruby-on-rails - 当使用与有限列的关系时,包括仍然导致第二个数据库查询

ruby-on-rails - Rails : Why is my . 每个循环都被跳过了吗?

ruby-on-rails - 避免将逻辑放在 View 上以根据条件显示元素

ruby-on-rails - 如何调试 Rails 的内部工作?

mysql - 安装 MYSql 后,Rails 寻找 MySQL 而不是 Postgres

ruby - 在 Ruby 中获取 CGI 参数(query_string、path_info 等)

console - 在控制台中记录 requirejs 的依赖关系