运行cron job`require'时出错:无法加载此类文件 - bundler/setup(LoadError)

Ami*_*tel 3 ruby-on-rails crontab whenever rvm-capistrano capistrano3

我已经使用Capistrano 3部署了应用程序.我一直在跟踪错误.

`require': cannot load such file -- bundler/setup (LoadError)
Run Code Online (Sandbox Code Playgroud)

这是cron选项卡列表

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'
Run Code Online (Sandbox Code Playgroud)

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
Run Code Online (Sandbox Code Playgroud)

请注意,所有宝石都安装在defaultgemset中

Ami*_*tel 6

请注意,所有gem都安装在默认的gemset中

我有3个宝石可供投入生产.Rails使用的default是安装所有必需gem的地方.

从crontab列表中可以看出,crontab也在globalgemset目录中查找路径.

所以我只选择了globalgemset并安装bundler

$ rvm gemset use global
$ gem install bundler
Run Code Online (Sandbox Code Playgroud)

这些步骤解决了这个问题.


use*_*176 5

这对我有用:

rvm cron setup
Run Code Online (Sandbox Code Playgroud)