Ruby Passenger:没有这样的文件来加载捆绑程序
我使用 Nginx 安装了 Phusion Passenger,将 Nginx 配置为指向正确的目录,然后我运行 webapp 目录,这已经下载了 gemfiles,但找不到 gems。
当我访问该网站时,我收到标准的 Passenger 错误页面,其中显示:
Error message:
no such file to load -- bundler
这是完整的错误: http://tinypic.com/view.php?pic=vpx36r&s=7
我已经做了一个gem install bundler
所以我知道bundler已安装,但我认为它在错误的地方寻找宝石。
看起来好像 Passenger 已经安装了 ruby-enterprise-1.8.7 并且看起来这个盒子里已经安装了 1.8。
gem env 给了我以下信息:
- RUBYGEMS VERSION: 1.4.2
- RUBY VERSION: 1.8.7 (2009-12-24 patchlevel 248) [x86_64-linux]
- INSTALLATION DIRECTORY: /opt/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8
- RUBY EXECUTABLE: /opt/local/ruby-enterprise-1.8.7-2010.01/bin/ruby
- EXECUTABLE DIRECTORY: /opt/local/ruby-enterprise-1.8.7-2010.01/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /opt/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8
- /root/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
从我读到的内容来看,这似乎是一个路径问题,但我不知道解决它的最佳行动方案是什么。
的输出
这是which ruby:
/opt/local/ree/bin/ruby
whichbundle:
/opt/local/ree/bin/bundle
,我在该目录中运行了bundleinstall,它给了我:
Your bundle is complete! It was installed into ./vendor/bundle
I installed Phusion Passenger with Nginx, configured Nginx to point to the right directory, Then I ran webapp directory and this has downloaded the gemfiles, but it can't find the gems.
When I visit the site I get the standard Passenger error page which says:
Error message:
no such file to load -- bundler
Here's the full error: http://tinypic.com/view.php?pic=vpx36r&s=7
I've do a gem install bundler
so I know bundler is installed, but I think it's looking in the wrong place for the gems.
It appears as if Passenger has installed ruby-enterprise-1.8.7 and it looks like 1.8 was already installed in this box.
gem env gives me the following:
- RUBYGEMS VERSION: 1.4.2
- RUBY VERSION: 1.8.7 (2009-12-24 patchlevel 248) [x86_64-linux]
- INSTALLATION DIRECTORY: /opt/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8
- RUBY EXECUTABLE: /opt/local/ruby-enterprise-1.8.7-2010.01/bin/ruby
- EXECUTABLE DIRECTORY: /opt/local/ruby-enterprise-1.8.7-2010.01/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /opt/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8
- /root/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
From what I've read it appears to be a path issue, but I don't know what the best course of action is to fix it.
Here's the output of
which ruby:
/opt/local/ree/bin/ruby
which bundle:
/opt/local/ree/bin/bundle
I've run bundle install in that directory and it's given me:
Your bundle is complete! It was installed into ./vendor/bundle
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来你有一些路径问题(正如你已经说过的)。尝试检查为什么您的 ruby 安装有两个不同的路径。
我的意思是,根据你的 gem env 输出,你有一些安装
,但你也有 ruby 和 Bunlder,
所以,从这里开始检查所有路径是否正确和/或你没有任何双重安装(嗯,这是足以检查您的 ENV 是否一致)。
另一个问题可能与您的 nginx.conf 有关,您应该有这样的内容:
更新(刚刚看到 nginx.conf 的附加注释):
如您所见,路径有问题:您有ruby 和 gems 安装的两条路径:
您
应该删除后者(不是物理上的,只需检查 ENV 以指向第一个)
编辑:
要更改您的环境,您可以将以下行附加到您的 /etc/bash.bashrc (或者默认情况下从 shell 加载的任何文件):
然后注销并登录,或者进行快速测试,从 shell 启动此命令:
现在source /etc/bash.bashrc
,重试查看默认使用的二进制文件:
所有内容都应该具有/opt/local/ruby-enterprise-1.8.7-2010.01/ 前缀(这是 nginx 和乘客配置中使用的)。
更新2:从评论来看,您至少安装了 3 个 ruby:
此时,最好的办法是:
卸载(清除)系统提供的 ruby 软件包(您不需要它)
安装和设置 RVM:https://rvm.io
it looks like you have some path issues (as you already stated). try to check why you have two different paths for your ruby installation.
I mean, according to your gem env output, you have some installation on
but you also have ruby and bunlder under
so, start from here to check if all the paths are correct and/or you haven't any double installations (well, it's just enough to check if your ENVs are coherent).
Another issue could be related to your nginx.conf, you should have something like this:
UPDATE (just saw additional comments with nginx.conf):
as you can see, there's a problem with paths: you have two paths for ruby and gems installs:
and
you should remove the latter (not phisically, just review ENVs to point to the first one)
EDIT:
to change your env, you can append the following line to your /etc/bash.bashrc (or whaterver file is loaded from your shell by default):
then logout and login, or for a quick test, launche this command from shell:
source /etc/bash.bashrc
now, retry to see what binary is used by default with:
everything should have the /opt/local/ruby-enterprise-1.8.7-2010.01/ prefix (that's what is used from nginx and passenger configs).
UPDATE2: from the comments, it turned out that you have at least 3 ruby installs:
at this point, the best thing to do is:
uninstall (purge) system provided ruby packages (you don't need it)
install and setup RVM: https://rvm.io