我遇到这个错误我不明白(我对铁杆很新)当使用宝石时,无论什么时候出现这种错误。在开发模式中。
我所做的是更新config / schedule.rb并运行
whenever --update-crontab --set environment='development'
crontab -l列出:
* * * * * /bin/bash -l -c 'cd /home/vic/Desktop/WorkflowProject && bundle exec bin/rails runner -e development '\''Task.new2'\'' >> log/whenever.log 2>&1'
在config / schedule.rb
set :output, 'log/whenever.log'
every 1.minute do
runner "Task.new2"
end
at log / when.log
bundler: failed to load command: bin/rails (bin/rails)
Bundler::GemNotFound: Your bundle is locked to rake (11.3.0), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of rake (11.3.0) has removed it. You'll need to update your bundle to a different version of rake (11.3.0) that hasn't been removed in order to install.
/home/vic/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.2/lib/bundler/definition.rb:179:in `rescue in specs'
/home/vic/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.2/lib/bundler/definition.rb:173:in `specs'
/home/vic/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.2/lib/bundler/definition.rb:233:in `specs_for'
/home/vic/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.2/lib/bundler/definition.rb:222:in `requested_specs'
/home/vic/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.2/lib/bundler/runtime.rb:118:in `block in definition_method'
/home/vic/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.2/lib/bundler/runtime.rb:19:in `setup'
/home/vic/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.2/lib/bundler.rb:99:in `setup'
/home/vic/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.2/lib/bundler/setup.rb:20:in `<top (required)>'
/home/vic/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/home/vic/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
我非常感谢你的帮助,非常感谢你!
答案 0 :(得分:0)
答案 1 :(得分:0)
您确定要安装bundler
吗?尝试在应用程序目录中运行bundle install
。
如果不是,请参阅上面的Jayaprakash答案。
如果是,请尝试bundle exec whenever --update-crontab --set environment='development'
。
更新: 啊,错过了你的任务执行时看到的错误。 在config / schedule.rb
中试试这个env :PATH, ENV['PATH']
set :output, "#{ Whenever.path }/log/whenever.log"
every 1.minute do
runner "Task.new2"
end