gpt4 book ai didi

ruby-on-rails - 无法在 RVM Ubuntu 上从 Capistrano 执行 gem

转载 作者:行者123 更新时间:2023-12-04 19:17:13 24 4
gpt4 key购买 nike

我有一个 Rails 应用程序通过 Capistrano3 部署到带有 RVM 的 Ubuntu。

我正在尝试使用 Eye gem 但无法执行它。它是通过 Ubuntu 上的 RVM 安装的,我可以在 Ubuntu 上运行它。

namespace :eye do



desc 'Load Eye'


task :load do
on roles(:app) do

execute "cd #{current_path} && eye load #{current_path}/lib/tasks/conductor.eye"
end
end

end

我得到的错误是:
    bash: eye: command not found

帽子流产了!

如果我执行 bundle exec,我会得到同样的 bundler 错误..

如果我通过 Capistrano 运行 echo $PATH 我得到:
 BUG [f84df590] Command: echo $PATH
DEBUG [f84df590] /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

而 Ubuntu 上的 $PATH 是:
  /home/cmsapplication/.rvm/gems/ruby-2.1.1/bin:/home/cmsapplication/.rvm/gems/ruby-2.1.1@global/bin:/home/cmsapplication/.rvm/rubies/ruby-2.1.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/cmsapplication/.rvm/bin:/home/cmsapplication/.rvm/bin

帽文件:
require 'capistrano/setup'
require 'capistrano/deploy'

require 'capistrano/rails'
require 'capistrano/bundler'
require 'capistrano/rvm'
require 'capistrano/puma'
require "whenever/capistrano"

Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

最佳答案

确保您拥有以下文件:

~/.bash_profile

    [[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile

source ~/.profile

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

~/.profile
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

并将您的任务中的行从
execute "cd #{current_path} && eye load #{current_path}/lib/tasks/conductor.eye"


execute "cd #{current_path} && /bin/bash --login -c 'eye load #{current_path}/lib/tasks/conductor.eye'"

关于ruby-on-rails - 无法在 RVM Ubuntu 上从 Capistrano 执行 gem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33227483/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com