【问题标题】:System rvm is not working on direct call系统 rvm 无法直接调用
【发布时间】:2014-07-18 17:33:16
【问题描述】:

我正在使用 CentOS。这是我的输出:

# which rvm
/usr/local/rvm/bin/rvm
# rvm ruby-1.9.3-p392@gemset
# /usr/local/rvm/bin/rvm ruby-1.9.3-p392@gemset
RVM is not a function, selecting rubies with 'rvm use ...' will not work.

You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for a example.

如您所见,我是否只使用rvm 一切正常。但是capistrano 在这样的命令中使用完整路径

[46f28bd9] Command: cd /var/www/app/releases/20140718172057 && /usr/local/rvm/bin/rvm ruby-1.9.3-p392@gemset do bundle install --binstubs /var/www/app/shared/bin --path /var/www/app/shared/bundle --without development test --deployment --verbose

所以它只是失败了,所有的 gem 都安装在默认的 ruby​​ 上,而不是 ruby-1.9.3-p392@gemset

感谢您的任何建议。

【问题讨论】:

  • 也许可以试试/usr/bin/env rvm?
  • 你在使用登录shell吗? rvm.io/integration/gnome-terminal
  • @NickVeys /usr/bin/env rvm 产生与rvm 和/usr/local/rvm/bin/rvm 相同的输出,但/usr/bin/env rvm ruby-1.9.3-p392 给了我RVM is not a function。只有rvm ruby-1.9.3-p392 按预期工作@nsave 是的,我是

标签: ruby-on-rails ruby rvm capistrano rvm-capistrano


【解决方案1】:

我的假设:

  • 您使用的是 Capistrano v3
  • 已经在你的 Capfile 中包含了require 'capistrano/rvm'
  • 当您 cd 进入您的项目目录时,您会看到类似 .ruby-version 和 .ruby-gemset 为您设置 RVM。

你可能想尝试这样的事情

within fetch(:current_path) do
    with rails_env: fetch(:rails_env) do
        execute :bundle, "install"
    end
end

Tasks 在 v3 中的工作方式有所不同:https://github.com/capistrano/capistrano#tasks

tl;dr: execute(:bundle, :install) 和 execute('bundle install') 的行为不同!

【讨论】:

    猜你喜欢
    • 2022-07-09
    • 1970-01-01
    • 2019-07-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-24
    • 2012-02-16
    • 2020-07-08
    相关资源
    最近更新 更多