zsh:1:找不到命令:rake

时间:2016-04-27 18:09:11

标签: ruby-on-rails rake zsh capistrano3

我在使用Capistrano进行部署时尝试执行rake,但我发现要执行问题,因为ZSH

zsh:1: command not found: rake

所以我从我的机器上删除了ZSH,但同样的问题仍然存在。

config/deploy.rb

desc 'My task'
task :my_task do
  on roles(:app) do
    execute 'rake my:task'
  end
end

日志:

00:00 deploy:my_task
      01 rake my:task
      01 zsh:1: command not found: rake
      01
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host example.com: rake my:task exit status: 127
rake my:task stdout: zsh:1: command not found: rake
rake my:task stderr: Nothing written
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/sshkit-1.10.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/sshkit-1.10.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
SSHKit::Command::Failed: rake my:task exit status: 127
rake my:task stdout: zsh:1: command not found: rake
rake my:task stderr: Nothing written
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/sshkit-1.10.0/lib/sshkit/command.rb:100:in `exit_status='
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/sshkit-1.10.0/lib/sshkit/backends/netssh.rb:136:in `execute_command'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/sshkit-1.10.0/lib/sshkit/backends/abstract.rb:137:in `block in create_command_and_execute'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/sshkit-1.10.0/lib/sshkit/backends/abstract.rb:137:in `tap'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/sshkit-1.10.0/lib/sshkit/backends/abstract.rb:137:in `create_command_and_execute'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/sshkit-1.10.0/lib/sshkit/backends/abstract.rb:69:in `execute'
config/deploy.rb:92:in `block (3 levels) in <top (required)>'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/sshkit-1.10.0/lib/sshkit/backends/abstract.rb:29:in `instance_exec'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/sshkit-1.10.0/lib/sshkit/backends/abstract.rb:29:in `run'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/sshkit-1.10.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => deploy:upload_assets

1 个答案:

答案 0 :(得分:0)

这与zsh无关;相反,它似乎只能在环境的路径中找到耙子。三个选项:

  1. 你没有安装rake。 (只需安装它:gem install rake)
  2. 您安装了它,但它不在$ PATH中。 (将其添加到路径:export PATH = $ PATH:/ usr / local / bin / :)
  3. 您已将其安装在$ PATH中,但没有权限执行它。 (chomd + x rake)