[英]capistrano is pulling the wrong ruby version from rvm
I have a rails 5 app.我有一个 rails 5 应用程序。 I was trying to hunt down a memory leak and it opened up a can of worms.
我试图寻找内存泄漏,它打开了一罐蠕虫。 One of the worms is rvm and deploy.
其中一种蠕虫是 rvm 和 deploy。 I do not have
我没有
rvm_ruby_string
set anywhere in the project.设置在项目的任何地方。 If I go to the directory of the project, and do either
如果我转到项目目录,然后执行任一操作
bundle exec ruby --version
or或
ruby --version
both result in两者都导致
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin14]
However, if I do但是,如果我这样做
cap staging deploy
you can see it somehow picks up the wrong version:你可以看到它以某种方式选择了错误的版本:
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
Now if I simply try to mimic what capistrano says it's doing, by copying and pasting the following to the command line:现在,如果我只是尝试模仿 capistrano 所说的它正在做的事情,通过将以下内容复制并粘贴到命令行:
~/.rvm/bin/rvm current
I get我得到
ruby-2.3.1
So, I'm stumped.所以,我很难过。 Where is Capistrano pulling the rvm var from?
Capistrano 从哪里提取 rvm var?
You are probably running cap staging deploy
as a different user then when you ran ruby --version
.当您运行
ruby --version
时,您可能正在以不同的用户身份运行cap staging deploy
。
Based on the capistrano output, you are using deploy
user to deploy.根据 capistrano 输出,您正在使用
deploy
用户进行部署。 If this is the case, you need to install ruby 2.3.1 as deploy
user, and set 2.3.1 to "default and current".如果是这种情况,您需要以
deploy
用户身份安装 ruby 2.3.1,并将 2.3.1 设置为“默认和当前”。
You can test this by running ruby --version
as both deploy
user and the other user you used to run it the first time.您可以通过以
deploy
用户和第一次运行它的其他用户身份运行ruby --version
来测试这一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.