【问题标题】:The --deployment flag requires a Gemfile.lock. Please make sure you have checked your Gemfile.lock into version control before deploying--deployment 标志需要 Gemfile.lock。请确保您在部署之前已将 Gemfile.lock 签入版本控制
【发布时间】:2013-06-27 03:09:06
【问题描述】:

当我在服务器上使用 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 中为捆绑程序使用任何设置,所以我错过了一个设置或 什么?

提前致谢

【问题讨论】:

  • 如果你 ssh 进入服务器,cd 进入你的应用目录,然后简单地执行 bundle install 会发生什么?还是不行吗?

标签: deployment capistrano bundler


【解决方案1】:

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

set :bundle_gemfile, "app/Gemfile"

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-14
    • 2011-10-21
    • 1970-01-01
    • 2013-01-08
    • 1970-01-01
    相关资源
    最近更新 更多