简体   繁体   English

在 Rails 上冻结时无法写入锁定文件 Ruby

[英]Can't write to lockfile while frozen Ruby on Rails

Hello I'm trying to run the following commands to prep my Rails app for production:您好,我正在尝试运行以下命令来准备我的 Rails 应用程序以进行生产:

bundle lock --add-platform ruby

bundle lock --add-platform x86_64-linux

Then I get this error:然后我得到这个错误:

Cannot write a changed lockfile while frozen.

What is going on here?这里发生了什么? What is the lockfile for?锁文件有什么用? What does it mean to be frozen?被冻结是什么意思?

Running the following command allowed me to write to my lock file运行以下命令允许我写入我的锁定文件

bundle config unset deployment   

What is the lockfile for?锁文件有什么用?

The presence of a Gemfile.lock in a.. repository ensures that a fresh checkout of the repository uses the exact same set of dependencies every time.存储库中存在Gemfile.lock可确保每次对存储库进行新签出时都使用完全相同的依赖集。 https://bundler.io/v2.2/guides/faq.html https://bundler.io/v2.2/guides/faq.html

What does it mean to be frozen?被冻结是什么意思?

--frozen Do not allow the Gemfile.lock to be updated after this install. --frozen 不允许在安装后更新 Gemfile.lock。 Exits non-zero if there are going to be changes to the Gemfile.lock.如果要对 Gemfile.lock 进行更改,则退出非零。 https://bundler.io/v2.2/man/bundle-install.1.html https://bundler.io/v2.2/man/bundle-install.1.html

This probably doesn't apply to you yet, but in Bundler 3, --deployment will imply --frozen .这可能还不适用于你,但在 Bundler 3 中,-- --frozen --deployment

thats because you are in production and you dont want any changes to you Gemfile.lock file in deployment, so you freeze it, to unfreeze it run:那是因为你在生产中,你不想在部署中对你的 Gemfile.lock 文件进行任何更改,所以你冻结它,解冻它运行:

bundle config unset frozen

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM