简体   繁体   中英

Error running cron job `require': cannot load such file — bundler/setup (LoadError)

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

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.

这对我有用:

rvm cron setup

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM