我已经重复这个教程好几个星期了: https://www.digitalocean.com/community/articles/how-to-1-click-install-ruby-on-rails-on-ubuntu-12-10-with-digitalocean
以下是我的项目的具体情况: 我正在将 Mongoid 与 database.yml 生产集一起使用,并将其设置为运行 MongoDB 的经过测试且工作的 Droplet(DigitalOcean VPS)。
我的 gem 文件在这里,我是 Rails 新手,不太确定它是否设置正确,所以我只是将它们全部移动到 Assets 中,希望 Unicorn 可以为我提供这些 gem?
source 'https://rubygems.org'
gem 'rails', '3.2.14'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem "therubyracer"
gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
gem "twitter-bootstrap-rails"
gem 'redcarpet', '1.17.2'
gem 'uglifier', '>= 1.0.3'
gem "will_paginate_mongoid"
gem 'will_paginate', '~> 3.0.5'
gem 'will_paginate-bootstrap'
gem 'devise'
gem 'jquery-rails'
gem "mongoid", "~> 3.0.0"
end
这就是我所做的: 我使用 DigitalOcean 的一键安装程序。然后我使用 FileZilla 通过 SFTP 访问他们提供给我的凭据。我删除了/home/rails 中的所有文件,并将新文件从我的项目中放入。然后我执行了bundle install,并重新启动了unicorn服务。在教程中我看到我可以跟踪unicorn的日志,所以我执行了这个:tail -f/home/unicorn/log/unicorn.log
这是我关心的输出:
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/bundler-1.3.5/lib/bundler/runtime.rb:33:in `block in setup': You have already activated rack 1.5.2, but your Gemfile requires rack 1.4.5. Using bundle exec may solve this. (Gem::LoadError)
我看到了一些其他解决方案,但都失败了。以下是我尝试过的解决方案: 删除我的 Gemfile.lock,然后重新捆绑安装它。进入文件并删除它所说的机架。运行bundle install --binstubs。使用之前的bundle exec 重新启动unicorn 服务。错误仍然相同。
我之前遇到过很多不同的错误,但我觉得这是我遇到的最接近的错误。如果有人可以向我解释这一点(我是 Rails 新手,希望得到彻底的解释),并可能帮助我修复错误,那就太好了,结束了这种挫败感。
最佳答案
只是一个大胆的猜测
gem "rack", "~> 1.4.5"
可能适合您,然后当然是捆绑安装
。
关于ruby-on-rails - Unicorn 对我的机架版本不满意?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20865240/