Rails 3.2: Trying to use 'Whenever' gem but log file keeps giving: Could not find multi_json-1.1.0 in any of the sources (Bundler::GemNotFound) error
I am trying to use the Whenever gem to schedule a weekly task for sending out an email. I first tested to make the email would actually be sent by making a method call every time a User was updated. So now, I'm trying to have the email sent weekly instead of with every update, however I keep getting the following error in my cron.log file:
Could not find multi_json-1.1.0 in any of the sources (Bundler::GemNotFound)
I've done quite a bit of research and haven't found anything yet, any help would be great. I'll post the relevant code below:
class WeeklyDigestTestMailer < ActionMailer::Base default from: "email@example.com" def send_email(user) @user = user @last_question = @user.questions.last.description mail to: @user.email, subject: "This is a test email" end end
def self.send_email_to_user WeeklyDigestTestMailer.send_email(self).deliver end
every 1.minute do runner "User.send_email_to_user", :environment => 'development', :output => 'log/cron.log' end
source 'https://rubygems.org' gem 'rails', '3.2.0' gem "bootstrap-tooltip-rails", "~> 0.1" gem 'whenever', :require => false group :production do gem "exception_notification", "~> 2.5.2", :require => 'exception_notifier' gem "mysql", "~> 2.8.1" end group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.1' gem 'uglifier', '>= 1.0.3' end gem "jquery-rails" gem "devise", "~> 2.0.4" gem 'gauge', git: 'firstname.lastname@example.org:AgilionApps/gauges.git' gem "capistrano" gem "capistrano-ext" group :development do gem "awesome_print", "~> 1.0.2" gem "mail", "2.4.1" end group :test do gem "minitest", "~> 2.11.2" gem "turn", "~> 0.9.3" gem "mocha", "~> 0.10.4" end group :test, :development do gem "sqlite3", "~> 1.3.5" end group :staging do # gem "pg", "~> 0.13.1" end
Bundle install output:
Using rake (0.9.2.2) Using i18n (0.6.0) Using multi_json (1.1.0) Using activesupport (3.2.0) Using builder (3.0.0) Using activemodel (3.2.0) Using erubis (2.7.0) Using journey (1.0.3) Using rack (1.4.1) Using rack-cache (1.1) Using rack-test (0.6.1) Using hike (1.2.1) Using tilt (1.3.3) Using sprockets (2.1.2) Using actionpack (3.2.0) Using mime-types (1.17.2) Using polyglot (0.3.3) Using treetop (1.4.10) Using mail (2.4.1) Using actionmailer (3.2.0) Using arel (3.0.2) Using tzinfo (0.3.31) Using activerecord (3.2.0) Using activeresource (3.2.0) Using ansi (1.4.2) Using awesome_print (1.0.2) Using bcrypt-ruby (3.0.1) Using bundler (1.1.4) Using rack-ssl (1.3.2) Using json (1.6.5) Using rdoc (3.12) Using thor (0.14.6) Using railties (3.2.0) Using rails (3.2.0) Using bootstrap-tooltip-rails (0.1) Using highline (1.6.11) Using net-ssh (2.3.0) Using net-scp (1.0.4) Using net-sftp (2.0.5) Using net-ssh-gateway (1.1.0) Using capistrano (2.11.2) Using capistrano-ext (1.2.1) Using chronic (0.6.7) Using coffee-script-source (1.2.0) Using execjs (1.3.0) Using coffee-script (2.2.0) Using coffee-rails (3.2.2) Using orm_adapter (0.0.6) Using warden (1.1.1) Using devise (2.0.4) Using exception_notification (2.5.2) Using gauge (0.0.2) from email@example.com:AgilionApps/gauges.git (at master) Using jquery-rails (2.0.0) Using metaclass (0.0.1) Using minitest (2.11.2) Using mocha (0.10.4) Using mysql (2.8.1) Using sass (3.1.15) Using sass-rails (3.2.4) Using sqlite3 (1.3.5) Using turn (0.9.3) Using uglifier (1.2.3) Using whenever (0.7.3) Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
I've had similar issues on OS X. Mainly because of different versions of Ruby installed. Or the built-in version fighting with versions I've installed myself.
Things to check:
- type which ruby in a terminal
- does the output make sense with what you have installed?
- are you using any Ruby managers (like rvm or rbenv)?
- if so, check your paths in /.bash_profile or /.bashrc to see where they point. This link might help with installing and configuring rbenv.
- I use rbenv so I have this in my bash_profile before any other $PATH declarations to make sure it grabs those executables first:
- what does gem env say? Is it the right path?
- I run Ruby 1.9.3 locally but have to deal with 1.8.7 remotely because of issues with our hosting company so I have both versions installed locally. I forget to update the bundle install for the right version of Ruby command and scratch my head when I get errors like the one you are seeing. Hopefully you don't have this problem, but I'm just pointing it out in case it leads you down the right path.
- does bundle exec rails console or bundle exec rails server do the same thing as rails console and rails server respectively?
- If they don't, where are you installing the bundles? Simply bundle install or bundle install --path vendor/bundle?
If you're getting desperate, remove the built-in version of Ruby and install a fresh version with either rvm or rbenv (I prefer rbenv after having lots of problems with rvm) and try again to see if that works.