0

我有以下 Capistrano 片段:

namespace :bundle do
    task :install do
        run "gem list && bundle -v"
    end
end

当我跑

cap bundle:install

我得到以下输出:

 ** [out :: ....compute-1.amazonaws.com]
 ** [out :: ....compute-1.amazonaws.com] *** LOCAL GEMS ***
 ** [out :: ....compute-1.amazonaws.com]
 ** [out :: ....compute-1.amazonaws.com]
 ** [out :: ....compute-1.amazonaws.com] bundler (1.3.4)
 ** [out :: ....compute-1.amazonaws.com] rake (10.0.3)
 ** [out :: ....compute-1.amazonaws.com] rubygems-bundler (1.1.1)
 ** [out :: ....compute-1.amazonaws.com] rvm (1.11.3.6)
 ** [out :: ....compute-1.amazonaws.com]
 ** [out :: ....compute-1.amazonaws.com] ERROR: Gem bundler is not installed, run `gem install bundler` first.

gem 显示 bundler 已安装,但是当我尝试运行 bundle -v 时,我得到一个矛盾的错误,说它不是?我不明白为什么?

我尝试的另一件事是通过终端登录到服务器,当我在那里运行 bundle -v 时,它工作正常吗?

有什么想法有什么问题吗?

4

2 回答 2

0

你使用rvm-capistrano gem吗?它将为您加载 RVM。

于 2013-03-16T02:54:17.380 回答
0

我设法通过添加一些环境变量来使我的脚本工作:

set :default_environment, {
    :PATH => "/home/ubuntu/.rvm/gems/ruby-1.9.2-p320@my_gemset/bin:" +
        "/home/ubuntu/.rvm/gems/ruby-1.9.2-p320@global/bin:" +
        "/home/ubuntu/.rvm/rubies/ruby-1.9.2-p320/bin:" +
        "/home/ubuntu/.rvm/bin:" +
        "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
    :RUBY_VERSION => 'ruby-1.9.2-p320',
    :GEM_HOME => '/home/ubuntu/.rvm/gems/ruby-1.9.2-p320@my_gemset',
    :GEM_PATH => '/home/ubuntu/.rvm/gems/ruby-1.9.2-p320@my_gemset:/home/ubuntu/.rvm/gems/ruby-1.9.2-p320@global'
}
于 2013-03-18T15:53:17.033 回答