Search code examples
deploymentcapistranobundler

The --deployment flag requires a Gemfile.lock. Please make sure you have checked your Gemfile.lock into version control before deploying


I get this error when i deploy with Capistrano on a server, I have tried to solve it for about 3 hours now unsuccessfully this errors happens when cap runs bundle install

executing "cd $HOME/releases/20130629113827 && bundle install --gemfile $HOME/releases/20130629113827/Gemfile --path $HOME/shared/bundle --deployment --quiet --without development test"
executing command
The --deployment flag requires a Gemfile.lock. Please make sure you have checked
your Gemfile.lock into version control before deploying.

Here is what i reached so far :

  • both Gemfile and Gemfile.lock exists on the server
  • Gemfile.lock exists in the application root directory directly (it's not inside a folder or something)
  • the releases folder doesn't have any files beside the actual releases directories
  • i compared all the gems in Gemfile with Gemfile.lock and they all exists
  • I have both my Gemfile and Gemfile.lock checked in the scm and .bundle is in the ignore list

I don't use any settings for bundler in Capistrano so did i miss a setting or something?

Thanks in advance


Solution

  • I got it.The problem was that my rails application root directory is inside another directory called app so Capistrano was looking for Gemfile in a wrong directory i solved the simply by adding this to deploy.rb :

    set :bundle_gemfile, "app/Gemfile"
    

    I hope this can help anyone who have this problem