Search code examples
ruby-on-railsrubydeploymentrakecapistrano

Capistrano: Could not find rake-$WRONG_VERSION in any of the sources


We use rvm on our servers and I just upgraded to Ruby 2.3.1. Now when I try to deploy our project to the staging server I get this error message:

** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:

 DEBUG [49e3047b] Finished in 0.269 seconds with exit status 0 (successful).
  INFO [96bd9c75] Running ~/.rvm/bin/rvm default do bundle exec rake gettext:pack as [email protected]
 DEBUG [96bd9c75] Command: cd /home/deployer/PROJECTNAME/current && ( export RAILS_ENV="production" ; ~/.rvm/bin/rvm default do bundle exec rake gettext:pack )
 DEBUG [96bd9c75]       /home/deployer/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/spec_set.rb:95:in `block in materialize'
 DEBUG [96bd9c75]       :
 DEBUG [96bd9c75]       Could not find rake-11.1.2 in any of the sources
 DEBUG [96bd9c75]        (
 DEBUG [96bd9c75]       Bundler::GemNotFound
 DEBUG [96bd9c75]       )
 DEBUG [96bd9c75]               from /home/deployer/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/spec_set.rb:88:in `map!'
 DEBUG [96bd9c75]               from /home/deployer/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/spec_set.rb:88:in `materialize'
 DEBUG [96bd9c75]               from /home/deployer/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/definition.rb:140:in `specs'
 DEBUG [96bd9c75]               from /home/deployer/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/definition.rb:185:in `specs_for'
 DEBUG [96bd9c75]               from /home/deployer/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/definition.rb:174:in `requested_specs'
 DEBUG [96bd9c75]               from /home/deployer/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/environment.rb:19:in `requested_specs'
 DEBUG [96bd9c75]               from /home/deployer/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/runtime.rb:14:in `setup'
 DEBUG [96bd9c75]               from /home/deployer/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler.rb:95:in `setup'
 DEBUG [96bd9c75]               from /home/deployer/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/setup.rb:19:in `<top (required)>'
 DEBUG [96bd9c75]               from /home/deployer/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
 DEBUG [96bd9c75]               from /home/deployer/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'

This is very odd, because Gemfile.lock has rake at version 11.2.2! When I ssh to the staging server and do a manual bundle install everything works ok, too. This is the .bundle/config file on the staging server:

---
BUNDLE_FROZEN: '1'
BUNDLE_PATH: "/home/deployer/PROJECTNAME/shared/bundle"
BUNDLE_WITHOUT: development:test
BUNDLE_DISABLE_SHARED_GEMS: true

I updated capistrano, bundler, passenger and nginx, but I just can't get it to work. I also deleted /home/deployer/PROJECTNAME/shared/bundle without any change. Strangely after running another deploy it created /home/deployer/PROJECTNAME/shared/bundle/ruby/2.3.0/bundler. See the 2.3.0? But the Ruby version I installed is 2.3.1!

Why would it look for that wrong version of rake anyway? I really have no idea what is going on. Damn it Jim, I'm a software developer, not a system administrator!

Edit: I gave in and actually wrote rake version 11.1.2 into the Gemfile. Now I get the same message but for activesupport:

Could not find activesupport-4.2.6 in any of the sources

WTF is going on? Why all these old versions? I don't want them!


Solution

  • I think I solved this by updating the react_on_rails gem. But this is cargo cult computing. I never found out why it behaved that way and I just tried out things. I also deleted tmp/cache.