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

假装没事ソ 提交于 2020-02-24 05:27:32

问题


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


回答1:


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.




回答2:


This worked for me:

rvm cron setup


来源:https://stackoverflow.com/questions/32293583/error-running-cron-job-require-cannot-load-such-file-bundler-setup-loader

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!