--deployment标志需要Gemfile.lock。在部署之前,请确保已将Gemfile.lock检入版本控制

时间:2013-06-29 12:08:30

标签: deployment capistrano bundler

当我在服务器上部署Capistrano时出现此错误,我已经尝试解决它大约3个小时现在失败,当cap运行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.

这是我到目前为止所达到的目标:

  • 服务器上存在Gemfile和Gemfile.lock
  • Gemfile.lock直接存在于应用程序根目录中(它不在文件夹或其他内容中)
  • releases文件夹在实际版本目录旁边没有任何文件
  • 我将Gemfile中的所有gem与Gemfile.lock进行了比较,它们都存在
  • 我在scm中检查了我的Gemfile和Gemfile.lock,并且.bundle在忽略列表中

我没有在Capistrano中使用捆绑器的任何设置,所以我错过了一个设置或 什么?

提前致谢

1 个答案:

答案 0 :(得分:5)

我明白了。问题是我的rails应用程序根目录位于另一个名为app的目录中,因此Capistrano在错误的目录中寻找Gemfile我只需将其添加到deploy.rb即可解决:

set :bundle_gemfile, "app/Gemfile"

我希望这可以帮助任何有这个问题的人