2

I've used whenever gem with ruby 1.9.2 without any problems, but I installed ruby 1.9.3p125 on my server and it stopped working.

All I get below error on my cron_error.log file:

/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- bundler/setup (LoadError)
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /home/APP_NAME/config/boot.rb:6
from script/rails:5:in `require'
from script/rails:5

I checked paths for rake, gem and ruby and everything is under "/usr/local/bin/" and my path is like below:

/usr/local/jdk/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/courier-imap/sbin:/usr/lib/courier-imap/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin 

I am struggling with this for hours, any help appreciated!

tackleberry
  • 1,003
  • 2
  • 12
  • 16
  • I couldn't find any solution. Removed all ruby installations, installed rvm with r1.9.2 and now everything works. – tackleberry Mar 30 '12 at 09:47

3 Answers3

2

Are you using rvm? You might have to set it to use 1.9.3. Your error shows it's using the default system ruby, which is version 1.8:

/usr/lib/ruby/site_ruby/1.8/...

You can check the path with which ruby.

If all else fails, you could try rvm use 1.9.3 --default (providing you are using rvm)

Mark Sands
  • 1,509
  • 1
  • 14
  • 15
  • no actually I am not using rvm. ruby 1.9.3p0 was installed in server, I've installed ruby 1.9.3p125 before deploying my app. BTW app is just working fine, I am only having issues with cron jobs. – tackleberry Mar 29 '12 at 23:28
  • and I only have /usr/lib/ruby/site_ruby/1.8/ dir on my server, probably 1.9 versions using 1.8 dir too – tackleberry Mar 29 '12 at 23:30
  • please check question detail, I tried which ruby, gem, rake and all points "/usr/local/bin/" which seems added o PATH – tackleberry Mar 29 '12 at 23:34
1

Installing ruby doesn't mean, that all gems are also installed.

Perhaps you need to install the gems also in your new ruby installation?


Your error message is in a ruby 1.8 path, not in the new installed ruby 1.9. Are your sure you run in the correct ruby version?

Perhaps your rails is connected to an old ruby 1.8 installation?

knut
  • 27,320
  • 6
  • 84
  • 112
  • I installed all gems, and tried installing whenever explicitly by gem install whenever. I also checked it via irb, and looks fine: irb(main):005:0> require 'whenever' => true – tackleberry Mar 29 '12 at 22:54
  • ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux] what I get when I typed ruby -v – tackleberry Mar 29 '12 at 22:57
  • Your log is from a cron-job? It is not said, that your irb is using the same ruby as your cron-job. (I'm not familair with rails, so maybe I'm wrong) – knut Mar 30 '12 at 08:42
  • actually they are using same ruby, but I already gave up. re-installed everything. thank you for your effort – tackleberry Mar 30 '12 at 09:46
  • Too late to help maybe, but I would suggest adding this to your crontab to find out for sure what version cron is using, since it sounds like it was using a different version. * * * * * ruby -v – Tyler Rick Mar 06 '13 at 22:08
0

if your using rvm, you can't just:

rvm use 1.9.3 --default

you need to state the gemset too, thus having an accepted .rvmrc that states the gemset is important.

rvm use ruby-1.9.3-p125@rails-3.2.3 --default 

seems to work also.

at least that was my experience with using the above version of ruby and rails. also, the whenever gem would default to production. so if your using whenever to create the cron job you might want to also state:

bundle exec whenever --set 'environment=development' -w
boar
  • 93
  • 1
  • 8