4

I'm trying to upload my Rails app with:

bin/cap production deploy

but the deployment is failing with this error message:

You have requested:                                                                     
  capistrano ~> 3.3.0                                                                   

The bundle currently has capistrano locked at 3.7.1.                                    
Try running `bundle update capistrano`                                                  

If you are updating multiple gems in your Gemfile at once,                              
try passing them all to `bundle update`

I tried to fix the issue by running:

bundle update capistrano

but that did not solve it.

The thing I don't get is that I don't see where my application 'asks for capistrano 3.3.0'. In my Gemfile I set Capistrano to version 3.7.

Besides the capistrano gem I'm also using:

gem capistrano-rails, '~> 1.2'
gem capistrano3-delayed-job, '~> 1.3'
gem capistrano-figaro-yml

My Gemfile is at:

https://github.com/acandael/personalsite/blob/master/Gemfile

Does someone know how I can fix this Capistrano version issue?

thanks for your help,

Anthony

Markus
  • 5,667
  • 4
  • 48
  • 64
Toontje
  • 1,415
  • 4
  • 25
  • 43

3 Answers3

5

Please follow all the steps in the right order (don't skip any because you did it)

  1. cd into your project directory
  2. run bundle exec gem uninstall capistrano -a to remove all capistrano versions from your bundle
  3. run gem uninstall capistrano -a to remove all capistrano versions from your system. Note that you may need to run this with root access if you get an error message
  4. run bundle install
  5. run bundle exec gem list capistrano which should output all installed gems with a name that contains "capistrano". You are supposed to have only one version of the capistrano gem
  6. check in your files config/deploy.rb and config/deploy/*.rb if you have a lock 3.x.x instruction, and make sure it matches the install version as show in step 5
  7. run cap in bundle context with bundle exec cap production deploy (use exactly this command line, do not use bin/cap)
Benjamin Bouchet
  • 12,971
  • 2
  • 41
  • 73
  • I did all the steps. The error with capistrano 3.3.0 is gone. But now I'm getting this error: SSHKit::Runner::ExecuteError: Exception while executing as deploy@146.185.164.246: bundle exit status: 137 – Toontje Feb 05 '17 at 10:32
  • Good, so you fixed the gem problem. This "bundle exit status: 137" error is unrelated.Try http://stackoverflow.com/questions/23390311/rails-4-1-cant-deploy-via-capistrano-3 Or else open a new ticket. – Benjamin Bouchet Feb 06 '17 at 07:44
  • yeah, it turned out that restarting the server fixed the bundle exit status: 137 error. Thanks a lot for your help! – Toontje Feb 06 '17 at 10:34
  • Should check config/deploy for the lock instruction as mentioned in step 6 before the other steps, I think - that alone fixed my problem. – himanish.k May 30 '18 at 17:48
0

try bundle exec cap production deploy

Nirajan Pokharel
  • 1,099
  • 1
  • 7
  • 15
  • delete your gemfile.lock then bundle install and retry ! – Nirajan Pokharel Feb 01 '17 at 19:00
  • tried it, but get the same error message. The problem is that the error says I'm having capistrano 3.3.0 while the Gemfile.lock has version 3.7.1. But I can't find this version 3.3.0 in my Gemfile. Am I missing something? – Toontje Feb 01 '17 at 19:06
  • maybe 3.7.1 is required as dependencies, run `gem list` to see the list of gem installed , and run `gem install capistrano -v 3.7.1` – Nirajan Pokharel Feb 01 '17 at 19:14
0

try to remove YOUR_APP/.bindle directory and run bundle install again

itsnikolay
  • 17,415
  • 4
  • 65
  • 64
  • I removed the .bundle directory and than ran bundle install, but I'm still getting the same error message – Toontje Feb 04 '17 at 15:20