Rails + Capistrano `rbenv: 2.3.1 is not installed or not found in $HOME/.rbenv/versions/2.3.1`
Asked Answered
I

1

7

I'm getting an rbenv: 2.3.1 is not installed or not found in $HOME/.rbenv/versions/2.3.1 when trying to deploy to Digital Ocean with Capistrano.

Does rbenv look on my local machine or on the DO droplet for the ruby version?? Or both for that matter...

The output on DO for which ruby is `/home/deploy/.rbenv/shims/ruby

The output on DO for ruby -v is ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]

...so it looks like I have ruby installed correctly but it just isn't recognising it??

In my Capfile I have

require 'capistrano/rbenv' set :rbenv_type, :user # or :system, depends on your rbenv setup set :rbenv_ruby, '2.3.1'

I'm following the guide on GoRails.

This SO question suggests that ruby should be installed on the root user. In my case I have installed it as user deploy.

Isolating answered 9/1, 2017 at 1:43 Comment(0)
I
6

As per the post I linked to. I thought I was changing the path correctly to point to the deploy home directory but I was using $HOME instead of /home.

deploy.rb was updated to set :rbenv_path, '/home/deploy/.rbenv' instead of set :rbenv_path, '$HOME/deploy/.rbenv' and it is now working correctly.

Isolating answered 9/1, 2017 at 1:59 Comment(1)
I'm facing a similar issue, capistrano throws rbenv: ruby-3.0.2 is not installed or not found in /home/deploy/.rbenv/versions/ruby-3.0.2 on 10.0.2.206 but on server I've installed ruby with deploy user and which ruby returns /home/deploy/.rbenv/shims/ruby. My deploy.rb has set :rbenv_path, '/home/deploy/.rbenvIna

© 2022 - 2024 — McMap. All rights reserved.