Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LoadError: cannot load such file -- capistrano/rbenv

I'm following this guide to deploy my Rails app on DigitalOcean using Capistrano.

At the end of stop 5 I check the server availability through the following command:

cap production deploy:check

Which results in:

alucardu@alucardu-VirtualBox:~/sites/movieseat$ cap production deploy:check
cap aborted!
LoadError: cannot load such file -- capistrano/rbenv
/home/alucardu/sites/movieseat/Capfile:18:in `<top (required)>'
(See full trace by running task with --trace)

In my gemfile I have:

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

And:

group: :development do
  gem 'capistrano', '~> 3.0', require: false
  gem 'capistrano-bundler', require: false
  gem 'capistrano-rails', require: false
  gem 'capistrano-rbenv', github: 'capistrano/rbenv', require: false
end

In my Capfile I have:

require 'capistrano/rbenv'
# require 'capistrano/chruby'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'

I also did a rbenv version check.

alucardu@alucardu-VirtualBox:~/sites/movieseat$ rbenv -v
rbenv 0.4.0-98-g13a474c

Can someone point me to the problem?

UPDATE

I guess I hadn't installed the gem yet.

Fixed it.

gem install capistrano-rbenv
like image 400
Peter Boomsma Avatar asked Oct 31 '14 12:10

Peter Boomsma


2 Answers

Capistrano's tasks usually run in production environment. So in your Gemfile add gems related to capistrano in production group

group :development, :production do
  gem 'capistrano', '~> 3.0', require: false
  gem 'capistrano-bundler', require: false
  gem 'capistrano-rails', require: false
  gem 'capistrano-rbenv', github: 'capistrano/rbenv', require: false
end
like image 187
Guilherme Moretti Avatar answered Nov 02 '22 09:11

Guilherme Moretti


I fixed this by running bundle exec cap production deploy instead of cap production deploy.

like image 4
Paul Schreiber Avatar answered Nov 02 '22 07:11

Paul Schreiber