gpt4 book ai didi

ruby - 无法在生产服务器上更新 gem

转载 作者:数据小太阳 更新时间:2023-10-29 06:25:29 25 4
gpt4 key购买 nike

无法在生产服务器上更新 gem。

我已经尝试过 bundle install --deploymentbundle install --without development test

但不断得到:

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.

If this is a development machine, remove the Gemfile freeze
by running `bundle install --no-deployment

编辑

我不知道这是否正确,但需要快速修复。我运行了 bundle install --no-deployment 然后 bundle update 然后再次运行了 bundle install --deployment

最佳答案

说明可能有点困惑。这表示您已经在您的开发机器上修改了您的 Gemfile,并且只是推送了这些更改,而不是在提交更改之前运行 bundle install

通过运行 bundle install,您将更新您的 Gemfile.lock 文件。这应该被推送到您的服务器,因为它比 Gemfile 更重要。考虑 Gemfile Gemfile.lock 文件的计划。

永远记住:

  1. 如果您更改了Gemfile,请运行bundle install,即使只是为了确保。如果它太慢,通过 --local 强制它只使用本地 gem 来解决它的依赖关系。
  2. GemfileGemfile.lock 文件提交到您的存储库
  3. GemfileGemfile.lock 部署到您的生产服务器,以确保它们运行与您的开发环境完全相同的依赖项。

单独运行 bundle update 可能会被认为是危险的,因为它会更新应用程序的所有依赖项。如果您没有在 Gemfile 中指定可靠的版本号,这主要是危险的。我 wrote about it here.

关于ruby - 无法在生产服务器上更新 gem ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6785626/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com