【问题标题】:capistrano is pulling the wrong ruby version from rvmcapistrano 从 rvm 中提取了错误的 ruby​​ 版本
【发布时间】:2018-01-27 20:11:51
【问题描述】:

我有一个 rails 5 应用程序。我试图寻找内存泄漏,它打开了一罐蠕虫。其中一种蠕虫是 rvm 和 deploy。我没有

rvm_ruby_string

在项目的任何地方设置。如果我转到项目的目录,然后执行任一操作

bundle exec ruby --version

ruby --version

两者都导致

ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin14]

但是,如果我这样做了

cap staging deploy

你可以看到它以某种方式选择了错误的版本:

DEBUG [778e15cb] Running /usr/bin/env which passenger as deploy@xxxx
DEBUG [778e15cb] Command: /usr/bin/env which passenger
DEBUG [778e15cb]    /usr/bin/passenger
DEBUG [778e15cb] Finished in 0.710 seconds with exit status 0 (successful).
DEBUG [0da5c891] Running [ -d ~/.rvm ] as xxx
DEBUG [0da5c891] Command: [ -d ~/.rvm ]
DEBUG [0da5c891] Finished in 0.101 seconds with exit status 0 (successful).
DEBUG [f2734c3e] Running ~/.rvm/bin/rvm version as 
xxx
DEBUG [f2734c3e] Command: ~/.rvm/bin/rvm version
DEBUG [f2734c3e]    rvm 1.29.1 (latest) by Michal Papis, Piotr Kuczynski, 
Wayne E. 
Seguin [https://rvm.io/]
DEBUG [f2734c3e] Finished in 0.268 seconds with exit status 0 (successful).
rvm 1.29.1 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin 
[https://rvm.io/]
DEBUG [a2e3d82a] Running ~/.rvm/bin/rvm current as xx
DEBUG [a2e3d82a] Command: ~/.rvm/bin/rvm current
DEBUG [a2e3d82a]    ruby-2.5.0

现在,如果我只是尝试模仿 capistrano 所说的内容,请将以下内容复制并粘贴到命令行:

~/.rvm/bin/rvm current

我明白了

ruby-2.3.1

所以,我被难住了。 Capistrano 从哪里提取 rvm var?

【问题讨论】:

  • 进入您的服务器并检查服务器中安装了哪些 rubies 版本。在您的服务器 rvm list 中执行此操作。检查哪个版本的 rvm 设置为默认值。
  • 你在哪里声明你想使用的 ruby​​ 版本?如果您没有声明 ruby​​ 版本,它是否默认使用最新的稳定 ruby​​ 版本。这是 2.5
  • 默认设置为 2.3.1

标签: ruby-on-rails rvm capistrano


【解决方案1】:

您运行cap staging deploy 时可能与运行ruby --version 时不同。

根据 capistrano 输出,您正在使用 deploy 用户进行部署。如果是这种情况,您需要以deploy 用户身份安装ruby 2.3.1,并将2.3.1 设置为“默认和当前”。

您可以通过以 deploy 用户和您第一次运行它的其他用户的身份运行 ruby --version 来测试它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-12-30
    • 1970-01-01
    • 2023-04-02
    • 1970-01-01
    • 2014-06-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多