3

I have deployed application using Capistrano 3. I keep on getting following error.

`require': cannot load such file -- bundler/setup (LoadError)

Here is the cron tab list

PATH=/home/deploy/magnificent/shared/bundle/ruby/2.2.0/bin:/usr/local/rvm/gems/ruby-2.2.2/bin:/usr/local/rvm/gems/ruby-2.2.2@global/bin:/usr/local/rvm/rubies/ruby-2.2.2/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

* * * * * /bin/bash -l -c 'cd /home/deploy/magnificent/releases/20150830045359 && bin/rails runner -e production '\''Document.process_pending'\'' >> log/cron_standard.log 2>> log/cron_error.log'

and schedule.rb

env :PATH, ENV['PATH']
set :output, { error: 'log/cron_error.log', standard: 'log/cron_standard.log'}

every 1.minutes do
  runner 'Document.process_pending'
end

Please note here that all the gems are installed in default gemset

Amit Patel
  • 15,609
  • 18
  • 68
  • 106

2 Answers2

6

Please note here that all the gems are installed in default gemset

I had 3 gemsets available in production. Rails is using default one where all required gems are installed.

As can be seen in the crontab list, crontab is also looking path in global gemset directory as well.

So I just selected global gemset and install bundler

$ rvm gemset use global
$ gem install bundler

These steps fixed the issue.

Amit Patel
  • 15,609
  • 18
  • 68
  • 106
  • when attempting to issue the first step, i get "RVM is not a function, selecting rubies with 'rvm use ...' will not work" – user1130176 May 10 '16 at 14:32
  • I did the same thing and it solved my problem except it included ```rvm gemset create global``` first. Then it reinstalled all of my gems and my app was running perfectly. – amatusko Sep 28 '16 at 22:09
5

This worked for me:

rvm cron setup
user1130176
  • 1,772
  • 1
  • 23
  • 33