[英]'sh: rake: not found' error when deploying with Capistrano
When trying to execute the command cap deploy
from a Windows machine, I'm getting this error coming back from the VPS: 当尝试从Windows计算机执行命令
cap deploy
,我从VPS返回此错误:
sh: rake: not found
If I SSH into the server itself, I can easily run rake
without issues. 如果我将SSH连接到服务器本身,我可以轻松地运行
rake
而不会出现问题。 It's in a weird location because I'm using RVM, but it still works. 它位于一个奇怪的位置,因为我正在使用RVM,但它仍然有效。 It seems like somehow the knowledge of its location is getting messed up when it's being run from Capistrano.
似乎某种程度上,当它从Capistrano运行时,它的位置知识变得混乱。
Agile Web Development with Rails adds the following to deploy.rb
: 使用Rails的Agile Web开发为
deploy.rb
添加了以下deploy.rb
:
# adjust if you are using RVM, remove if you are not
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
set :rvm_ruby_string, '1.9.2'
set :rvm_type, :user
The problem is, I'm on a Windows machine (not using RVM), and that causes the whole deploy
Capistrano task to crash because I don't have RVM. 问题是,我在Windows机器上(不使用RVM),这导致整个
deploy
Capistrano任务崩溃,因为我没有RVM。 Do I need to have RVM installed locally for this to work? 我是否需要在本地安装RVM才能使用? I would expect it's only necessary on the server.
我希望它只在服务器上有用。
Why the heck can't rake
be found?! 为什么找不到
rake
?! Sure works when I SSH into the server myself... 当我自己SSH服务器时,确实有效...
EDIT: It looks like this question is very similar: 编辑:看起来这个问题非常相似:
Capistrano fails to deploy to remote server Capistrano无法部署到远程服务器
However, his solution appears to involve doing the same thing I was trying to do -- except somehow he has no problem with the line require "rvm/capistrano"
, which crashes on my machine. 然而,他的解决方案似乎涉及做我想做的事情 - 除了某种程度上他没有问题线
require "rvm/capistrano"
,它在我的机器上崩溃了。 Also, his paths don't appear to be in the same format as mine? 此外,他的路径似乎与我的路径不同?
Mine: /home/sysadmin/.rvm/gems/ruby-1.9.3-p194@global/bin/rake
我的:
/home/sysadmin/.rvm/gems/ruby-1.9.3-p194@global/bin/rake
His: /usr/local/rvm/gems/ruby-1.9.2-p290@rails31dataserver/bin
他的:
/usr/local/rvm/gems/ruby-1.9.2-p290@rails31dataserver/bin
I'm really confused about how these environments work... 我真的很困惑这些环境如何工作......
Duh, I didn't have the Capistrano RVM gem installed, so I couldn't require "rvm/capistrano"
correctly. Duh,我没有安装Capistrano RVM gem,所以我不能正确地
require "rvm/capistrano"
。 gem install rvm-capistrano
fixed this issue. gem install rvm-capistrano
解决了这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.