Whenever: "bash: bundle: command not found" with Capistrano3, Rails 4.1 and RVM

Created on 11 Apr 2014  路  5Comments  路  Source: javan/whenever

I've got an error running whenever:update_crontab capistrano task.

I'm using RVM, but running whenever is going without changing directory to release_path and outside the block rvm do; end.

Deploy output log:

....
DEBUG [8a3709a3] Finished in 0.159 seconds with exit status 0 (successful).
 INFO [7889f3c4] Running /usr/bin/env bundle exec whenever --update-crontab MYAPP_production --set environment=production --    roles=web,app,db on MYHOST
DEBUG [7889f3c4] Command: bundle exec whenever
DEBUG [7889f3c4]  bash: bundle: command not found
cap aborted!
SSHKit::Command::Failed: bundle exec whenever stdout: Nothing written
bundle exec whenever stderr: Nothing written
/Users/sk/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/command.rb:94:in `exit_status='
/Users/sk/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:142:in `block (4 levels) in _execute'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:551:in `call'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:551:in `do_request'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:561:in `channel_request'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:205:in `process'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:269:in `wait'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:164:in `block (2 levels) in _execute'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:514:in `call'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:205:in `process'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:166:in `block in _execute'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:123:in `tap'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:123:in `_execute'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:66:in `execute'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/whenever-0.9.2/lib/whenever/tasks/whenever.rake:9:in `block (3 levels) in setup_whenever_task'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/abstract.rb:89:in `with'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/whenever-0.9.2/lib/whenever/tasks/whenever.rake:8:in `block (2 levels) in setup_whenever_task'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/abstract.rb:81:in `within'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/whenever-0.9.2/lib/whenever/tasks/whenever.rake:7:in `block in setup_whenever_task'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/sk/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => whenever:update_crontab
(See full trace by running task with --trace)
The deploy has failed with an error: #<SSHKit::Command::Failed: bundle exec whenever stdout: Nothing written
bundle exec whenever stderr: Nothing written
>

My Capfile:

require 'capistrano/setup'
require 'capistrano/deploy'

require 'capistrano/rvm'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
require 'capistrano3/unicorn'
require "whenever/capistrano"

# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }

My config/deploy.rb:

lock '3.1.0'

set :application, 'myapp'
set :repo_url, '[email protected]'

server 'myhost', roles: %w{web app db}, user: 'apps'

set :deploy_to, -> { "/u/apps/#{fetch(:application)}" }
set :scm, :git
set :format, :pretty
set :log_level, :debug
set :linked_files, %w{config/application.yml config/database.yml}
set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle public/uploads}

set :keep_releases, 10
set :rvm_type, :user
set :rvm_ruby_version, RUBY_VERSION

set :whenever_identifier, -> { "#{fetch(:application)}_#{fetch(:stage)}" }

namespace :deploy do
  desc 'Restart application'
  task :restart do
    invoke 'unicorn:restart'
    # on roles(:app), in: :sequence, wait: 5 do
    # end
  end

  after :publishing, :restart
end

Most helpful comment

Have anyone solved this issue, still having with capistrano 3 and rvm.

All 5 comments

Sorry, my fail.

After migration from Capistrano2 in my separated production stage config file remained require "whenever/capistrano"

I have the same error :( Don't know how to fix it

@cayerei Try this - set :whenever_command, [:bundle, :exec, :whenever]

@cayerei
... && [:bundle, :exec, :whenever] --update-crontab app_production --set environment=production
DEBUG[2a36d0e6] bash: [:bundle,: command not found

Have anyone solved this issue, still having with capistrano 3 and rvm.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Manju244 picture Manju244  路  10Comments

chronodm picture chronodm  路  7Comments

tonytonyjan picture tonytonyjan  路  21Comments

ringe picture ringe  路  13Comments

zsherman picture zsherman  路  17Comments