简体   繁体   中英

Bundler could not find compatible versions for gem “bundler” using whenever and rake tasks

I am running a rake task using whenever cron job but its giving error Bundler could not find compatible versions for gem "bundler": code sample is below

schedule.rb

set :output, {:error => "log/cron_error_log.log", :standard => "log/cron_log.log"}

every 1.minute do
  rake "twitter:search"
end

/lib/tasks/twitter.rake

namespace :twitter do
  desc "Search tweets for user"
  task :search => :environment do

    puts "searching for all users ......."
    # my original code 

  end
end

when i run my rake tasks using following commands

whenever --update-crontab
crontab -l

it run successfully but when i see log file log/cron_log.log i got following error after every 1 minute

Bundler could not find compatible versions for gem "bundler":
  In Gemfile:
    rails (= 4.1.1) depends on
      bundler (< 2.0, >= 1.3.0)

  Current Bundler version:
    bundler (1.0.15)

Note => when i run rake twitter:search in terminal it run successfully
Thank you for reading post and thanks a lot for suggestion

The error is telling you that you have the wrong version of bundler installed.

rails (= 4.1.1) depends on bundler (< 2.0, >= 1.3.0)

Bundler gem version must be less than 2.0 but greater than or equal to 1.3.0

Current Bundler version: bundler (1.0.15)

The installed version of bundler is 1.0.15 (smaller than 2.0 , but not greater than or equal to 1.3.0

TL;DR install the right version of bundler

$ gem install bundler --version '<2.0, >= 1.3.0'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM