运行cron作业`require'时出错:无法加载此类文件-捆绑程序/安装程序(LoadError) [英] Error running cron job `require': cannot load such file -- bundler/setup (LoadError)

查看:237
本文介绍了运行cron作业`require'时出错:无法加载此类文件-捆绑程序/安装程序(LoadError)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Capistrano 3部署了应用程序。我不断遇到以下错误。

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

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

这是cron选项卡列表

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'

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

请注意,所有gems均安装在 default gemset

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

推荐答案


请注意,所有gems均安装在默认gemset中

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

我有3个可生产的宝石。 Rails使用默认值之一,其中安装了所有必需的gem。

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

在crontab列表中可以看到crontab也在 global gemset目录中查找路径。

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

所以我只是选择了 global gemset并安装 bundler

So I just selected global gemset and install bundler

$ rvm gemset use global
$ gem install bundler

这些步骤解决了该问题。

These steps fixed the issue.

这篇关于运行cron作业`require'时出错:无法加载此类文件-捆绑程序/安装程序(LoadError)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆