Phusion Passenger:在本地计算机上部署应用程序时出现问题
我正在使用 Mac OS Snow Leopard、Apache Server、Phusion Passenger 和 RVM,并且尝试在本地计算机上部署 RoR 应用程序。
在我的 ~.etc/apache/httpd.conf
文件中,我有:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName mysite.com
DocumentRoot /Users/MyUserName/Sites/mysite.com/public
<Directory /Users/MyUserName/Sites/mysite.com/public>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
当我浏览 mysite.com
地址时,我收到以下 Phusion Passenger' 错误:
Error message:
no such file to load -- bundler
Exception class:
LoadError
Application root:
/Users/MyUserName/Sites/mysite.com
Backtrace:
# File Line Location
0 /Users/MyUserName/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb 36 in `require'
1 /Users/MyUserName/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb 36 in `require'
...
如何我可以解决这个问题吗?
控制台输出:
$ /usr/bin/ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin10.0]
$ echo $PATH
/Users/MyUserName/.rvm/gems/ruby-1.9.2-p290/bin:/Users/MyUserName/.rvm/gems/ruby-1.9.2-p290@global/bin:/Users/MyUserName/.rvm/rubies/ruby-1.9.2-p290/bin:/Users/MyUserName/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin
$ which ruby gem irb rake
/Users/MyUserName/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
/Users/MyUserName/.rvm/rubies/ruby-1.9.2-p290/bin/gem
/Users/MyUserName/.rvm/rubies/ruby-1.9.2-p290/bin/irb
/Users/MyUserName/.rvm/gems/ruby-1.9.2-p290/bin/rake
$ irb
1.9.2-p290 :001 > require "bundler"
=> true
I am using Mac OS Snow Leopard, Apache Server, Phusion Passenger and RVM and I am trying to deploy on my local machine a RoR application.
In my ~.etc/apache/httpd.conf
file I have:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName mysite.com
DocumentRoot /Users/MyUserName/Sites/mysite.com/public
<Directory /Users/MyUserName/Sites/mysite.com/public>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
When I browse the mysite.com
address I get the following Phusion Passenger' error:
Error message:
no such file to load -- bundler
Exception class:
LoadError
Application root:
/Users/MyUserName/Sites/mysite.com
Backtrace:
# File Line Location
0 /Users/MyUserName/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb 36 in `require'
1 /Users/MyUserName/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb 36 in `require'
...
How can I solve that?
Console outputs:
$ /usr/bin/ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin10.0]
$ echo $PATH
/Users/MyUserName/.rvm/gems/ruby-1.9.2-p290/bin:/Users/MyUserName/.rvm/gems/ruby-1.9.2-p290@global/bin:/Users/MyUserName/.rvm/rubies/ruby-1.9.2-p290/bin:/Users/MyUserName/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin
$ which ruby gem irb rake
/Users/MyUserName/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
/Users/MyUserName/.rvm/rubies/ruby-1.9.2-p290/bin/gem
/Users/MyUserName/.rvm/rubies/ruby-1.9.2-p290/bin/irb
/Users/MyUserName/.rvm/gems/ruby-1.9.2-p290/bin/rake
$ irb
1.9.2-p290 :001 > require "bundler"
=> true
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您使用的 ruby 版本可能不匹配。
Apache/passenger 可能设置为使用您的系统 ruby (1.8.7-p249),而不是您显然与 rvm 一起使用的 ruby 版本,我猜您收到“passenger 无法找到捆绑程序”消息的原因是因为您还没有没有使用您的系统 ruby 安装捆绑程序。
您可以通过在系统 ruby 版本中安装捆绑程序来解决此问题,或者告诉乘客使用通过 rvm 安装的任何 ruby 版本。
I think you might have a mismatch in what ruby versions are used.
Apache/passenger is probably set up to use your system ruby (1.8.7-p249), and not the ruby version you are obviously using with rvm, and I guess the reason you get the message that passenger cannot find bundler is because you haven't installed bundler using your system ruby.
You can fix this either by installing bundler in the system ruby version, or by telling passenger to use whatever ruby version you have installed via rvm.