I have a Rails project which was running on Ubuntu 18.04, and I've just upgraded the system to Ubuntu 20.04.
cap production deploy
is failing at the step deploy:assets:precompile
with:
00:07 deploy:assets:precompile
01 /home/deploy/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
01 bundler: failed to load command: rake (/var/www/framelinker/shared/bundle/ruby/2.6.0/bin/rake)
01 Gem::Exception: can't find executable rake for gem rake. rake is not currently included in the bundle, perhaps you meant to add it to your Gemfile?
I've tried adding rake to my gemfile, although I have a feeling this is not the answer because a) it didn't make any difference, and b) rake was not in my gemfile when everything was working on Ubuntu 18.04.
Googling around tells me to run gem update --system
but I'd rather not be messing with the server manually.
I'm using rbenv on the server. My gemfile is locked at ruby 2.6.1.
What's going on here? Isn't rake essentially built-in to ruby? Why would I have to add it to the gemfile?
--------------- Edit --------------
I'm wondering if Capistrano should be using something like this, rather than what it's doing above:
/home/deploy/.rbenv/bin/rbenv/shims/rake assets:precompile
My Capfile contents:
# Load DSL and set up stages
require "capistrano/setup"
# Include default deployment tasks
require "capistrano/deploy"
require 'capistrano/sidekiq'
install_plugin Capistrano::Sidekiq # Default sidekiq tasks
# Then select your service manager
install_plugin Capistrano::Sidekiq::Systemd
# Load the SCM plugin appropriate to your project:
#
# require "capistrano/scm/hg"
# install_plugin Capistrano::SCM::Hg
# or
# require "capistrano/scm/svn"
# install_plugin Capistrano::SCM::Svn
# or
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git
# Include tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
# https://github.com/capistrano/rvm
# https://github.com/capistrano/rbenv
# https://github.com/capistrano/chruby
# https://github.com/capistrano/bundler
# https://github.com/capistrano/rails
# https://github.com/capistrano/passenger
#
# require "capistrano/rvm"
require "capistrano/rbenv"
# require "capistrano/chruby"
require "capistrano/bundler"
require "capistrano/rails/assets"
require 'capistrano/rails/collection'
require "capistrano/rails/migrations"
require "capistrano/passenger"
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }