title: Capistrano: bundler: failed to load command: rake
body: <p>I am trying to deploy a Rails app from a Windows development machine to a Debian 9 VPS using Capistrano, Passenger, and RVM. I got RVM and Passenger set up with Apache on the VPS and Capistrano set up on the Windows machine. However, when I try to run <code>cap production deploy</code>, I get the following error:</p>
  
  <p><code>bundler: failed to load command: rake (/var/www/APPNAME/shared/bundle/ruby/2.4.0/bin/rake)</code></p>
  
  <p>One quirk of developing on Windows is that the <code>Gemfile.lock</code> must be edited on deployment to remove Windows-specific versions of gems. I have written a custom task to perform this action, which seems to run as expected.</p>
  
  <p>Here are some files that might be useful:</p>
  
  <ul>
  <li><a href="https://pastebin.com/tB49GX8j" rel="nofollow noreferrer">log/capistrano.log, starting with the custom task</a></li>
  <li><a href="https://pastebin.com/XGYfxc6b" rel="nofollow noreferrer">Gemfile</a></li>
  <li><a href="https://pastebin.com/NuEub8dD" rel="nofollow noreferrer">Gemfile.lock</a></li>
  <li><a href="https://pastebin.com/1mmpE2Dk" rel="nofollow noreferrer">Capfile</a></li>
  <li><a href="https://pastebin.com/t9AqynXE" rel="nofollow noreferrer">config/deploy.rb</a></li>
  <li><a href="https://pastebin.com/bFtvx89Y" rel="nofollow noreferrer">config/deploy/production.rb</a></li>
  <li><a href="https://pastebin.com/3h3fdkzh" rel="nofollow noreferrer">lib/capistrano/tasks/dewindowsify.rake (the custom task)</a></li>
  </ul>