为什么我的 Rails 应用程序看不到已安装的 gem?
运行 Ubuntu 10、RVM、Passenger 和 apache2。尝试配置并运行 Redmine。
首先,我将默认的 Ruby 二进制文件设置为 /usr/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby
。这就是 which ruby
的输出。 which gem
的输出是 /usr/local/rvm/rubies/ruby-1.9.2-p180/bin/gem
。我认为事情的这一面设置得当。
我知道 Passenger 正在运行,因为我收到错误屏幕,并显示以下错误:
错误消息:
<块引用>缺少 i18n 0.4.2 gem。请
gem install -v=0.4.2 i18n
更新乘客产生的错误来自boot.rb
文件。我了解了应用程序的 boot.rb 文件的要点。
当我检查是否安装了该 gem 时,这是输出。
# 宝石列表
# ...列表被截断...
# i18n (0.4.2)
(已安装 gem 的完整要点此处)
真的吗?让我们首先确保 Passenger.conf 进入正确的 Ruby 安装...
乘客.conf
<块引用>
PassengerRuby /usr/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby
>:| 现在,我通过 SSH 进入应用程序目录,还有什么,script/server
正常启动。我有点困惑了。显然,Passenger 配置的 Ruby 安装缺少其所说的 Gem,但已安装,此外,该应用程序在启动时不会出现问题。这让我认为这是乘客问题。
Running Ubuntu 10, RVM, Passenger and apache2. Trying to configure and get Redmine running.
First, I set my default Ruby binary to /usr/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby
. That's the output of which ruby
. Output of which gem
is /usr/local/rvm/rubies/ruby-1.9.2-p180/bin/gem
. I think that side of things is set up properly.
I know Passenger is running, because I'm getting an error screen, with this error:
Error message:
Missing the i18n 0.4.2 gem. Please
gem install -v=0.4.2 i18n
Update The error that passenger is producing is coming from the boot.rb
file. I went and made a gist of the application's boot.rb file.
When I do check to see if that gem is installed, here's the output.
# gem list
# ... list truncated ...
# i18n (0.4.2)
(full gist of installed gems here)
Really? Let's first make sure passenger.conf is going to the right Ruby installation...
passenger.conf
PassengerRuby /usr/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby
>:| So now, I go onto SSH into the application directory, and what have you, script/server
starts normally. I'm a little more than confused. Clearly the Ruby installation that Passenger is configured to has the Gem it says is missing, installed, and additionally, the application doesn't falter on a start up. Which makes me think it's a Passenger problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将 RVM 与 Passenger 一起使用有点复杂,也许这个关于使用 Ruby 和 Passenger 的链接会有所帮助。
Using RVM with Passenger is a bit complicated, maybe this link about using Ruby and Passenger will help.