1.我使用whenever gem 来定时启动 rails runner 任务;可是定时任务的log显示:
/usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/dependency.rb:319:in `to_specs': Could not find 'railties' (>= 0.a) among 17 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0:/root/.gem/ruby/2.3.0', execute `gem env` for more information
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/dependency.rb:328:in `to_spec'
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
from /usr/local/rvm/gems/ruby-2.3.0/bin/rails:22:in `<main>'
from /usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
from /usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
我也gem install railties了,可是还是这样,我的ruby version:2.3.0,rails version:4.1.0;
本人ruby 小白,求帮助
阿神2017-04-25 09:04:32
직접 질문하고 답하여 답변을 업데이트한 결과 "whenever +cron"의 함정인 것으로 나타났습니다. 그 이유는 GEM_PATH에 대한 매개변수가 cron에 추가되지 않았기 때문입니다.
으아악GEM_PATH 매개변수가 추가되었는지 확인하려면
으아악3.crontab -e cron 테이블을 편집하고 다음을 추가합니다:
으아악완료되었습니다.