【问题标题】:Gemfile.lock and gem's specific platform dependency?Gemfile.lock 和 gem 的具体平台依赖?
【发布时间】:2011-11-24 10:44:06
【问题描述】:

我的GemfileGemfile.lock 位于Git 存储库中,例如http://gembundler.com/deploying.html

我使用'rbconfig' 防止在Linux 生产服务器上加载rb-fsevent,但capistrano 在执行命令'bundle install' 时失败

我使用 capistrano 和 require 'bundler/capistrano'

查看堆栈跟踪:

You are trying to install in deployment mode after changing
Your Gemfile. Run 'bundle install' elsewhere and add the
Updated Gemfile.lock to version control.

You have deleted from the Gemfile:
rb-fsevent

在我的Gemfile

case HOST_OS
  when /darwin/i
    gem "rb-fsevent"
end

如何避免这种情况?

【问题讨论】:

标签: capistrano bundler


【解决方案1】:

我遇到了同样的问题,似乎捆绑器已经resolved this,但没有很好的记录。

尝试使用 install_if 和 lambda:

gem 'rb-fsevent', install_if: ->() { `uname` =~ /darwin/i }

【讨论】:

    【解决方案2】:

    在 Capistrano 上,您可以设置像 set :bundle_without, [:darwin] 这样的选项来跳过某些组,同时在生产中捆绑您的宝石。

    尝试在您的 Gemfile 中将 gem 分配给一个组:gem "rb-fsevent", group: :darwin,然后在您的本地计算机上执行 $ bundle && 推送到您的远程存储库后重试。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-18
      • 1970-01-01
      • 2018-03-24
      • 2023-03-23
      • 1970-01-01
      相关资源
      最近更新 更多