Search code examples
ruby-on-railscapistranorbenv

Capistrano rbenv - Ruby version not installed witn dry run


When I run Capistrano task with dry run it tells me that rbenv Ruby version can't be found. I assume with dry run it should use local environment. But when I run the commands locally I can easily find below mentioned directory and Ruby is installed.

> ./bin/bundle exec cap --dry-run development t

DEBUG [8171d925] Running [ ! -d ~/.rbenv/versions/2.4.3 ] as user@dev
DEBUG [8171d925] Command: [ ! -d ~/.rbenv/versions/2.4.3 ]
ERROR rbenv: 2.4.3 is not installed or not found in ~/.rbenv/versions/2.4.3

> ls ~/.rbenv/versions/2.4.3
bin include lib share

> rbenv global
2.4.3

> ruby -v
ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-darwin16]

> bundle info capistrano
* capistrano (3.4.0)

My Capfile contains below lines.

require 'capistrano/rbenv'
set :rbenv_type, :user
set :rbenv_ruby, '2.4.3'

I'm using Mac OS and installed rbenv with homebrew.


Solution

  • There must have been some bug in capistrano/rbenv. I have changed my Gemfile as follows and problem is solved.

    # gem 'capistrano-rbenv', '2.0.2'
    gem 'capistrano-rbenv', '~> 2.1'