无法更新生产服务器上的宝石 [英] Unable to update gems on production server
问题描述
无法更新生产服务器上的gem。
我试过 bundle install --deployment
和 bundle install --without development test
但是不断得到:
在您更改
您的Gemfile后,您正尝试以部署模式进行安装。在别处运行`bundle install`并将
更新的Gemfile.lock添加到版本控制中。
如果这是一台开发机器,通过运行`bundle install --no-deployment
> 编辑
我不知道这是否正确,但需要快速修复。我运行了 bundle install --no-deployment
然后 bundle update
然后运行 bundle install - 部署
再次
说明可能有点混乱。这就是说你已经在你的开发机器上修改了你的 Gemfile
,只是推送这些更改而不是运行 bundle install
BEFORE通过运行 bundle install
,你将更新你的 Gemfile.lock / code>文件。这应该被推送到你的服务器,因为它比
Gemfile
更重要。考虑 Gemfile
Gemfile.lock
文件的计划。
永远记住:
- 运行
bundle install
code> Gemfile ,即使只是为了确保。如果速度太慢,请通过- local
强制它仅使用本地gem来解析其依赖关系。 提交 > 将Gemfile
和Gemfile.lock
文件存储到您的存储库中 - 将您的生产服务器上的
Gemfile
和Gemfile.lock
部署到确保它们运行准确与您的开发环境相同的依赖项。
运行
本身可能被认为是危险的,它会更新应用程序的所有依赖关系。如果您没有在 Gemfile
中指定固体版本号,那么这很危险。我在这里写了关于。
Can not update gems on production server.
I've tried bundle install --deployment
and bundle install --without development test
But keep getting:
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
I don't know if this is correct, but needed a quick fix. I ran bundle install --no-deployment
then bundle update
then ran bundle install --deployment
again
The instructions are probably a bit confusing. It's saying that you've modified your Gemfile
on your development machine and just pushed those changes rather than running bundle install
BEFORE committing the changes.
By running bundle install
you will update your Gemfile.lock
file. This should be pushed to your server as it's more important than Gemfile
. Consider the Gemfile
the plans for the Gemfile.lock
file.
Always remember to:
- Run
bundle install
if you change yourGemfile
, even just to make sure. If it's too slow, pass--local
through which forces it to only use local gems to resolve its dependencies. - Commit both the
Gemfile
andGemfile.lock
file to your repository - Deploy both the
Gemfile
andGemfile.lock
to your production servers to ensure that they're running the exact same dependencies as your development environment.
Running bundle update
by itself can be construed as dangerous that will update all the dependencies of your application. It's mainly dangerous if you don't have solid version numbers specified in the Gemfile
. I wrote about it here.
这篇关于无法更新生产服务器上的宝石的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!