我一直在使用openshift一周,一切正常。不幸的是,无论是使用Ruby2.0还是Ruby1.9.3都无法在线访问Rails4控制台,这是一个真正的问题。
bundle exec rails console RAILS_ENV="production"
失败,要求我运行bundle install,并且bundle install失败,告诉我它无法安装活动支持4.1.4,即使在部署期间openshift说它安装在.vendor / bundle中。我尝试多次删除我的应用程序,重新创建,从github上的railsapp示例的干净版本开始......没有任何作用。
我希望你能提前帮助我
[app-root/repo]$ bundle exec rails console RAILS_ENV="production"
bundler: command not found: rails
Install missing gem executables with `bundle install`
[app-root/repo]$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Using rake (0.9.6)
Using i18n (0.6.11)
Using json (1.8.1)
Using minitest (5.4.0)
Using thread_safe (0.3.4)
Using tzinfo (1.2.1)
Installing activesupport (4.1.4)
Gem::InstallError: activesupport requires Ruby version >= 1.9.3.
An error occurred while installing activesupport (4.1.4), and Bundler
cannot continue.
Make sure that `gem install activesupport -v '4.1.4'` succeeds before
bundling.
[app-root/repo]$ gem install activesupport -v '4.1.4'
Fetching: i18n-0.6.11.gem (100%)
Successfully installed i18n-0.6.11
Fetching: thread_safe-0.3.4.gem (100%)
Successfully installed thread_safe-0.3.4
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: activesupport-4.1.4.gem (100%)
Successfully installed activesupport-4.1.4
4 gems installed
[app-root/repo]$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Using rake (0.9.6)
Using i18n (0.6.11)
Using json (1.8.1)
Using minitest (5.4.0)
Using thread_safe (0.3.4)
Using tzinfo (1.2.1)
Installing activesupport (4.1.4)
Gem::InstallError: activesupport requires Ruby version >= 1.9.3.
An error occurred while installing activesupport (4.1.4), and Bundler
cannot continue.
Make sure that `gem install activesupport -v '4.1.4'` succeeds before
bundling.
我正在使用Github上提供的Gemfile,稍作修改。我不得不稍微修改以下几行,否则rails会抱怨:
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
必须由
取代group :development do
gem 'spring'
end
group :doc do
gem 'sdoc', '~> 0.4.0'
end
询问您是否需要更多信息。
答案 0 :(得分:1)
我用
cd ~/app-root/repo && RAILS_ENV=production bundle exec rails console
它适用于我。
答案 1 :(得分:0)
OpenShift使用Gemfile格式非常挑剔:
就我而言:
gem' guard-rspec',require:false
必须:
gem' guard-rspec',:require =>假
修复了第一个错误,bundle抱怨文件格式,然后我遇到了宝石不存在的问题。
所以我再次连接到控制台并在其中安装了一个gem install bundler 应用部署/电流/回购
和
〜/ .gem / bin / bundle exec rails c
这次工作