45

I just ran bundle update and capistrano got updated to 3.0.0 but now when I run cap deploy I get an error and can't figure out how to fix this. I have been updating my server every day without problem until this update.

cap aborted!
cannot load such file -- deploy
/home/mark/rails_apps/myapp/Capfile:1:in `load'
/home/mark/rails_apps/myapp/Capfile:1:in `<top (required)>'

capfile

load 'deploy'
load 'deploy/assets'
load 'config/deploy' # remove this line to skip loading any of the default tasks
markhorrocks
  • 1,199
  • 19
  • 82
  • 151

9 Answers9

39

I had to gem uninstall capistrano and selected version 3.0.0

(i.e. downgraded the gem to 2.x)

Michał Szajbe
  • 8,830
  • 3
  • 33
  • 39
markhorrocks
  • 1,199
  • 19
  • 82
  • 151
  • Thank you. But how come everything was broke until i uninstalled it? I even didn't use that version, it was just in the bundler by accident. – Zippie Oct 09 '13 at 11:55
  • 6
    You evidently ran bundle update? I have now fixed my version to 2.15.5. so it won't ever update again until I see a tutorial on the subject. – markhorrocks Oct 09 '13 at 23:32
  • 1
    I had the same issue, downgrade it to capistrano 2.+ was the solution – phil88530 Oct 29 '13 at 11:19
  • Do you mean that Capistrano 3.0 doesn't support asset precompile? there must be a way to support that in Capistrano 3.0 – Don Giulio Feb 01 '14 at 15:23
21

I had to run gem uninstall capistrano

then update the gemfile with gem 'capistrano', '~> 2.15'

and then run to reinstall the correct version again with bundle update capistrano

pastullo
  • 4,171
  • 3
  • 30
  • 36
18

Make sure you are using bundle exec (most likely you have multiple gem versions of capistrano)

i.e.

bundle exec cap -T

stebooks
  • 2,317
  • 1
  • 20
  • 10
8

Instead of downgrading to Capistrano 2 use the new configuration from the current version.

require "capistrano/bundler"
require "capistrano/rails/assets"
require "capistrano/rails/migrations"

See also this nice posting, which summarises the differences between Capistrano 2 and 3.

disco crazy
  • 31,313
  • 12
  • 80
  • 83
4

Add the related gems to your Gemfile

i.e. for

gem 'capistrano-bundler' # for capistrano/bundler
gem 'capistrano-rails' # for capistrano/rails/*

Do not downgrade to 2.x for this.

reto
  • 16,189
  • 7
  • 53
  • 67
  • @sixty4bit please elaborate, or open a new stackoverflow question. – reto Apr 07 '15 at 18:04
  • It's been a couple weeks but I think I had to add require: false to avoid the load error. Note that the upgrade guide indicates this: http://capistranorb.com/documentation/upgrading/ – sixty4bit Apr 07 '15 at 18:09
3

I had this problem today and pastullo's solution above fixed it except that I had to run gem uninstall capistrano (as markhorrocks answered) not bundle uninstall capistrano.

I also found this blog on bundler very useful: http://viget.com/extend/bundler-best-practices

Thanks for sharing this as it saved me heaps of time. x

Meli
  • 467
  • 4
  • 10
2

The fastest way to fix this I have found is to backup the cap files (Capfile, config/deploy.rb, and config/deploy/*.rb) and then re capify (it's no longer called "capify"):

bundle exec cap install STAGES=staging,production

Then recreate your cap files from your backup. It will take you 5 minutes to do this and you'll be over the major Capistrano upgrade hump.

user1130176
  • 1,772
  • 1
  • 23
  • 33
1

I used

bundle exec cap production deploy

instead of just cap production deploy

Alexander Gorg
  • 1,049
  • 16
  • 32
0

in my case I have changed my project ruby version. may be bundle also work here.

but I changed it to back what it was in previously.

ex:

rbenv local 2.4.1
Alupotha
  • 9,710
  • 4
  • 47
  • 48