我首先安装所有这些依赖项:
sudo yum install ruby19 ruby19-devel gem rubygems19-devel make gcc postgresql9 postgresql9-devel postgresql9-server
然后我切换到root用户并运行
bundle install
我收到绿色成功消息:
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
但是,当我 cd 到目录并运行时
rails s -p80
我得到了所有这些并且它无法启动(我仍然是 root,因为如果我不是 root,绑定将无法工作到端口 80):
/usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- pg_ext (LoadError)
from /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require'
from /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /usr/local/share/gems/gems/pg-0.14.0/lib/pg.rb:4:in `<top (required)>'
from /usr/local/share/gems/gems/bundler-1.2.0/lib/bundler/runtime.rb:68:in `require'
from /usr/local/share/gems/gems/bundler-1.2.0/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /usr/local/share/gems/gems/bundler-1.2.0/lib/bundler/runtime.rb:66:in `each'
from /usr/local/share/gems/gems/bundler-1.2.0/lib/bundler/runtime.rb:66:in `block in require'
from /usr/local/share/gems/gems/bundler-1.2.0/lib/bundler/runtime.rb:55:in `each'
from /usr/local/share/gems/gems/bundler-1.2.0/lib/bundler/runtime.rb:55:in `require'
from /usr/local/share/gems/gems/bundler-1.2.0/lib/bundler.rb:128:in `require'
from /home/user/TransForm/config/application.rb:7:in `<top (required)>'
from /usr/local/share/gems/gems/railties-3.2.8/lib/rails/commands.rb:53:in `require'
from /usr/local/share/gems/gems/railties-3.2.8/lib/rails/commands.rb:53:in `block in <top (required)>'
from /usr/local/share/gems/gems/railties-3.2.8/lib/rails/commands.rb:50:in `tap'
from /usr/local/share/gems/gems/railties-3.2.8/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
也许有一种简单的方法可以从一开始就正确部署它,而不是搞乱错误的废话?我需要 PostgreSQL。除了这个 AWS EC2 实例之外,这个应用程序在任何地方都可以使用,所以我知道我的 Gemfile 是正确的。任何线索都会有所帮助。