Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 当rails中的gem没有运行时_Ruby On Rails_Ruby_Bash_Cron_Whenever - Fatal编程技术网

Ruby on rails 当rails中的gem没有运行时

Ruby on rails 当rails中的gem没有运行时,ruby-on-rails,ruby,bash,cron,whenever,Ruby On Rails,Ruby,Bash,Cron,Whenever,我有一个cron作业,用于向系统中的用户发送电子邮件,但它不想运行。我在日志中收到以下错误消息: rake aborted! Don't know how to build task 'cron:deliver_email' /Users/ghost/.rvm/gems/ruby-2.2.1@maalify/bin/ruby_executable_hooks:15:in `eval' /Users/ghost/.rvm/gems/ruby-2.2.1@maalify/bin/ruby_execu

我有一个cron作业,用于向系统中的用户发送电子邮件,但它不想运行。我在日志中收到以下错误消息:

rake aborted!
Don't know how to build task 'cron:deliver_email'
/Users/ghost/.rvm/gems/ruby-2.2.1@maalify/bin/ruby_executable_hooks:15:in `eval'
/Users/ghost/.rvm/gems/ruby-2.2.1@maalify/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)
如果我使用rake-cron:deliver\u-email从命令行启动了指定的rake任务(
rake'cron:deliver\u-email'
),则该任务正在正确运行

我已使用not require语句(:require=>false)将where添加到我的GEM文件中

这就是我的克朗工作的样子

▶ whenever 
* * * * * /bin/bash -l -c 'gem install rake >> log/cron_log.log 2>> log/cron_error_log.log'

* * * * * /bin/bash -l -c 'cd /Users/ghost/code/IdeaProjects/maalify && RAILS_ENV=development bundle exec rake cron:deliver_email --silent >> log/cron_log.log 2>> log/cron_error_log.log'

## [message] Above is your schedule file converted to cron syntax; your crontab file was not updated.
## [message] Run `whenever --help' for more options.

您需要告诉cron加载rvm环境。详情如下:


生产中的rbenv如何。因为我在生产中使用rbenv。您发布的错误输出表明正在使用
rvm
。您应该尽量不要在不同的环境中使用不同的工具。无论如何,对于
rbenv
请参见以下答案:
▶ whenever 
* * * * * /bin/bash -l -c 'gem install rake >> log/cron_log.log 2>> log/cron_error_log.log'

* * * * * /bin/bash -l -c 'cd /Users/ghost/code/IdeaProjects/maalify && RAILS_ENV=development bundle exec rake cron:deliver_email --silent >> log/cron_log.log 2>> log/cron_error_log.log'

## [message] Above is your schedule file converted to cron syntax; your crontab file was not updated.
## [message] Run `whenever --help' for more options.