Ruby Passenger:没有这样的文件来加载捆绑程序

发布于 2024-11-16 01:45:40 字数 1635 浏览 5 评论 0原文

我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

少钕鈤記 2024-11-23 01:45:40

看起来你有一些路径问题(正如你已经说过的)。尝试检查为什么您的 ruby​​ 安装有两个不同的路径。

我的意思是,根据你的 gem env 输出,你有一些安装

 /opt/local/ruby-enterprise-1.8.7-2010.01/

,但你也有 ruby​​ 和 Bunlder,

/opt/local/ree/

所以,从这里开始检查所有路径是否正确和/或你没有任何双重安装(嗯,这是足以检查您的 ENV 是否一致)。

另一个问题可能与您的 nginx.conf 有关,您应该有这样的内容:

[...]
 http {
  passenger_root /your/path/to/passenger/gem;
  passenger_ruby /path/to/ruby;
  [...]
 }

更新(刚刚看到 nginx.conf 的附加注释):

如您所见,路径有问题:您有ruby 和 gems 安装的两条路径:

/opt/local/ruby-enterprise....

/opt/local/ree

应该删除后者(不是物理上的,只需检查 ENV 以指向第一个)

编辑:
要更改您的环境,您可以将以下行附加到您的 /etc/bash.bashrc (或者默认情况下从 shell 加载的任何文件):

PATH="/opt/local/ruby-enterprise-1.8.7-2010.01/bin:$PATH"

然后注销并登录,或者进行快速测试,从 shell 启动此命令:

现在source /etc/bash.bashrc

,重试查看默认使用的二进制文件:

which ruby
which gem
which rake
gem env
...

所有内容都应该具有/opt/local/ruby-enterprise-1.8.7-2010.01/ 前缀(这是 nginx 和乘客配置中使用的)。

更新2:从评论来看,您至少安装了 3 个 ruby​​:

  • /usr/lib/ruby/ 中的包管理器中的 ruby​​(您使用的是 ubuntu linux 吗?)
  • / 中的 ruby opt/local/ree/
  • /opt/local/ruby-enterprise-.... 中有一个 ruby​​,

此时,最好的办法是:

  • 卸载 /opt/local/ 下的所有 ruby​​ 及其所有 gem
  • 卸载(清除)系统提供的 ruby​​ 软件包(您不需要它)

  • 安装和设置 RVM:https://rvm.io

  • 使用 RVM 重新安装乘客:https:// rvm.io/integration/passenger/
  • 修复 nginx.conf 以使用乘客路径和 ruby

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

 /opt/local/ruby-enterprise-1.8.7-2010.01/

but you also have ruby and bunlder under

/opt/local/ree/

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:

[...]
 http {
  passenger_root /your/path/to/passenger/gem;
  passenger_ruby /path/to/ruby;
  [...]
 }

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:

/opt/local/ruby-enterprise....

and

/opt/local/ree

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):

PATH="/opt/local/ruby-enterprise-1.8.7-2010.01/bin:$PATH"

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:

which ruby
which gem
which rake
gem env
...

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:

  • ruby from your package manager in /usr/lib/ruby/ (are you using ubuntu linux?)
  • a ruby in /opt/local/ree/
  • a ruby in /opt/local/ruby-enterprise-....

at this point, the best thing to do is:

  • uninstall all the rubys under /opt/local/ and all their gems
  • uninstall (purge) system provided ruby packages (you don't need it)

  • install and setup RVM: https://rvm.io

  • re-install passenger using RVM: https://rvm.io/integration/passenger/
  • fix nginx.conf to use passenger path and ruby
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文