# Weird problem "uninitialized constant Capistrano"

**URL:** <https://www.ruby-forum.com/t/weird-problem-uninitialized-constant-capistrano/218893>\
**Category:** Rails\
**Created:** [April 15, 2012, 5:25am UTC](https://www.ruby-forum.com/t/weird-problem-uninitialized-constant-capistrano/218893 "2012-04-15T05:25:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [April 15, 2012, 5:25am UTC](https://www.ruby-forum.com/t/weird-problem-uninitialized-constant-capistrano/218893/1 "2012-04-15T05:25:56Z")

</div>

Hi friends!

After hours of hard work searching for a solution, I appeal to the  
community to help me.  
I’m using Rails 3.2.3, Postgresql, RVM, and running Ubuntu Server 11.10  
in  
my own server machine.  
The command “cap deploy:check” returns:

You appear to have all necessary dependencies installed

* * *

Gemfile:  
source ‘[https://rubygems.org](https://rubygems.org)’  
gem ‘rails’, ‘3.2.3’  
gem ‘pg’  
gem ‘annotate’, :git =\> ‘git://github.com/ctran/annotate\_models.git’  
gem ‘kaminari’  
gem ‘factory\_girl\_rails’  
gem ‘paperclip’, ‘~\> 3.0’

group :assets do  
gem ‘sass-rails’, ‘~\> 3.2.3’  
gem ‘coffee-rails’, ‘~\> 3.2.1’  
gem ‘uglifier’, ‘\>= 1.0.3’  
end  
gem ‘jquery-rails’

group :development do  
gem ‘rspec-rails’  
gem ‘capistrano’  
end

gem ‘rvm-capistrano’

* * *

Capfile:  
load ‘deploy/assets’  
Dir[‘vendor/gems/_/recipes/_.rb’,‘vendor/plugins/_/recipes/_.rb’].each {  
|plugin| load(plugin) }  
load ‘config/deploy’

* * *

deploy.rb:  
require “bundler/capistrano”  
require “rvm/capistrano”  
set :rvm\_ruby\_string, ‘1.9.3’  
set :application, “digifoto”  
set :repository, “removed\_email\_address@domain.invalid:xxxxxxxx/digifoto.git”  
set :branch, “production”

set :scm, :git  
set :user, “[digifoto.com](http://digifoto.com)”  
set :deploy\_to, “/home/digifoto.com/apps/#{application}”  
set :deploy\_via, :remote\_cache

set :use\_sudo, false  
set :keep\_releases, 3

role :web, “xxx.xx.xx.xx” # Your HTTP server,  
Apache/etc  
role :app, “xxx.xx.xx.xx” # This may be the  
same  
as your `Web` server  
role :db, “xxx.xx.xx.xx”, :primary =\> true # This is where Rails  
migrations will run

set :port, 22

namespace :deploy do  
task :start do ; end  
task :stop do ; end  
task :restart, :roles =\> :app, :except =\> { :no\_release =\> true } do  
run “#{try\_sudo} touch #{File.join(current\_path,‘tmp’,‘restart.txt’)}”  
end  
end

* * *

The command “cap deploy:setup” works fine but “cap deploy:migrations”  
end  
up with this error:

rake aborted!  
\*\*\* [err :: xxx.xx.xx.xx] uninitialized constant Capistrano  
\*\*\* [err :: xxx.xx.xx.xx]  
\*\*\* [err :: xxx.xx.xx.xx] (See full trace by running task with --trace)  
command finished in 4130ms  
failed: “rvm\_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell ‘1.9.3’ -c ‘cd  
/home/digifoto.com/apps/digifoto/releases/20120415025916 && bundle exec  
rake RAILS\_ENV=production RAILS\_GROUPS=assets assets:precompile’” on  
xxx.xx.xx.xx

I tried many things, like run the command: “bundle exec rake  
assets:clean”  
and deleting the line “//= require\_tree” from  
app/assets/javascripts/application.js but nothing works!  
Any help will be much appreciated!

---

<div class="post-metadata">

**Author:** ![LuisRuby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ea666f/32.png) [@LuisRuby](https://www.ruby-forum.com/u/LuisRuby)\
**Post date:** [April 15, 2012, 11:34am UTC](https://www.ruby-forum.com/t/weird-problem-uninitialized-constant-capistrano/218893/2 "2012-04-15T11:34:34Z")

</div>

On Apr 15, 11:24am, LuisRuby [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I tried many things, like run the command: “bundle exec rake assets:clean”  
> and deleting the line “//= require\_tree” from  
> app/assets/javascripts/application.js but nothing works!  
> Any help will be much appreciated!

You have the rvm-capistrano gem in the main bit of your gemfile, so  
when your app boots bundler will try and load it. In turn, this refers  
to capistrano, which isn’t installed on your production servers  
because it’s only in your development group.

Move the rvm-capistrano gem to the development group, alongside  
capistrano and you should be fine.

Fred

---

<div class="post-metadata">

**Author:** ![LuisRuby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ea666f/32.png) [@LuisRuby](https://www.ruby-forum.com/u/LuisRuby)\
**Post date:** [April 16, 2012, 8:36am UTC](https://www.ruby-forum.com/t/weird-problem-uninitialized-constant-capistrano/218893/3 "2012-04-16T08:36:04Z")

</div>

WOW! It worked!  
It was exactly what you said!  
This was a newbie question!

Thank you very, very much!

Em domingo, 15 de abril de 2012 10h24min34s UTC-3, LuisRuby escreveu:
