/usr/bin/env ruby no such file or directory: Using capistrano 3, capistrano/rbenv, capistrano/bundler and capistrano/rails (using rails 4)
Ok, fixed it.
I added this:
set :default_env, { path: "~/.rbenv/shims:~/.rbenv/bin:$PATH" }
to my deploy.rb
.
I'm not sure is the best solution, but it worked.
Capistrano v3 could not find a Bundler
It seems that you had to add capistrano-rvm
. It will take care about your ruby and bundler paths.
bundle install doesn't work from capistrano
Rails Capistrano with wrong rbenv path?
Ensure to include and configure correctly the capistrano-rbenv gem
In your Gemfile:
group :development do
gem 'capistrano-rbenv'
end
In your Capfile:
require 'capistrano/rbenv'
Set the rbenv related variables in your config/deploy.rb:
# I assume your plugins directory is at /usr/local/rbenv/plugins
# shims directory at /usr/local/rbenv/shims
# and so on ... Adapt the following to your situation
set :default_env, {
path: '/usr/local/rbenv/plugins/ruby-build/bin:/usr/local/rbenv/shims:/usr/local/rbenv/bin:$PATH',
rbenv_root: '/usr/local/rbenv'
}
set :rbenv_roles, :all
set :rbenv_ruby, '2.2.2'
set :rbenv_ruby_dir, '/usr/local/rbenv/versions/2.2.2'
set :rbenv_custom_path, '/usr/local/rbenv'
capistrano not using rails environment with bundler properly
OK so looking at Capistrano::Bundler under 'Usage' I saw an option in there called :bundle_without and it looked promising. So I put set :bundle_without, 'production'
inside of my development.rb deploy script and it worked!
This doesn't solve the issue that Capistrano keeps trying to generate precompiled assets but I'm sure there's a solution out there like overriding the rake task or something.
Related Topics
Rails: Serializing Objects in a Database
Using a Ruby Script to Login to a Website via Https
Ruby Koans: Why Convert List of Symbols to Strings
Array.Include? Multiple Values
Creating an Empty File in Ruby: "Touch" Equivalent
"Ago" Date/Time Functions in Ruby/Rails
Rails Console Running Incredibly Slowly When Editing Text
Uninstall Ruby Version from Rbenv
Rails Flash Message Remains for Two Page Loads
Installing Ruby 2.3.X on Ubuntu 18.04 Is Causing an Error by the End of the Installation Process
How to Download a CSV File in Ruby on Rails