Rails 3-Bundler / Capistrano错误 [英] Rails 3 -- Bundler/Capistrano Errors
问题描述
我在开发箱上本地有一个基本的Rails 3应用程序,但是想要尽早测试部署以确保一切正常。我正在使用Capistrano进行部署。
I have a basic Rails 3 app working locally on my development box, but want to test out deploying early on to make sure everything works. I'm using Capistrano to deploy.
当我运行 cap deploy
时(在所有其他必要的设置之后),它会因以下错误而中断此命令:
When I run cap deploy
(after all the other necessary setup), it breaks on this command with this error:
[...]
* executing 'bundle:install'
* executing "bundle install --gemfile /var/www/trex/releases/20100917172521/Gemfile --path /var/www/trex/shared/bundle --deployment --quiet --without development test"
servers: ["www.[my domain].com"]
[www.[my domain].com] executing command
** [out :: www.[my domain].com] sh: bundle: command not found
command finished
[...]
因此,它似乎在服务器上找不到 bundle
命令。
So it looks like it can't find the bundle
command on the server.
但是,当我登录到服务器...
However, when I log in to the server...
$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]
$ rails -v
Rails 3.0.0
$ bundle -v
Bundler version 1.0.0
... 捆绑包
命令运行正常。
...the bundle
command works just fine.
出什么问题了?
-
(此外,出于完整性考虑:)
(Furthermore, for completeness:)
$ which ruby
~/.rvm/rubies/ruby-1.9.2-p0/bin/ruby
$ which rails
~/.rvm/gems/ruby-1.9.2-p0/bin/rails
$ which bundle
~/.rvm/gems/ruby-1.9.2-p0/bin/bundle
推荐答案
更新:
对于RVM> = 1.11.3,您现在应该使用< a href = https://github.com/wayneeseguin/rvm-capistrano rel = noreferrer> rvm-capistrano gem 。对于较旧的RVM> = 1.0.1,下面的答案仍然适用。
For RVM >= 1.11.3, you should now just use the rvm-capistrano gem. For older RVM >= 1.0.1, the answer below still applies.
原始答案:
好的,尽管我仍然还没有完全部署上限
工作,我确实解决了 this 问题。问题是Capistrano尝试为Bundler(和其他gems)使用与RVM路径不同的路径。
Okay, though I still haven't gotten a full cap deploy
to work, I did fix this problem. The problem was Capistrano trying to use a different path for Bundler (and other gems) than the RVM paths.
通过执行 cap检查Capistrano路径shell
,然后 echo $ PATH
。您可能会看到标准的 / usr / local / bin
和 / usr / bin
,但这不是RVM所在的位置
Check your Capistrano path by doing cap shell
, then echo $PATH
. You'll probably see your standard /usr/local/bin
and /usr/bin
, but that's not where RVM has Bundler, et al., stored.
编辑Capistrano config / deploy.rb
文件,然后添加每行这些说明:
Edit your Capistrano config/deploy.rb
file, and add the following lines, per these instructions:
# Add RVM's lib directory to the load path.
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
# Load RVM's capistrano plugin.
require "rvm/capistrano"
set :rvm_ruby_string, '1.9.2'
set :rvm_type, :user # Don't use system-wide RVM
Capistrano终于见到了Bundler并开始适当地装载宝石。
That finally got Capistrano to see Bundler and start loading gems appropriately.
这篇关于Rails 3-Bundler / Capistrano错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!