无法更新生产服务器上的 gem

2024-02-12

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

我试过了bundle install --deployment and bundle 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

EDIT

我不知道这是否正确,但需要快速修复。我跑了bundle install --no-deployment then bundle update然后跑了bundle install --deployment again


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

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

永远记住:

  1. Run bundle install如果你改变你的Gemfile,甚至只是为了确定。如果太慢就通过--local通过它强制它只使用本地 gem 来解决其依赖关系。
  2. Commit both the Gemfile and Gemfile.lock文件到您的存储库
  3. 部署两个Gemfile and Gemfile.lock到您的生产服务器,以确保它们运行与您的开发环境完全相同的依赖项。

Running bundle update其本身可以被理解为危险的,将会更新all您的应用程序的依赖关系。如果您没有在Gemfile. I 在这里写过。 http://ryanbigg.com/2011/01/why-you-should-run-bundle-update/

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法更新生产服务器上的 gem 的相关文章

随机推荐