Can't write to lockfile while frozen Ruby on Rails

3.3k Views Asked by At

Hello I'm trying to run the following commands to prep my Rails app for production:

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?

3

There are 3 best solutions below

1
CJG On

Running the following command allowed me to write to my lock file

bundle config unset deployment   
0
Azeer Esmail On

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:

bundle config unset frozen
0
Ben Trewern On

The other way to do this in development:

bundle lock --add-platform ruby

bundle lock --add-platform x86_64-linux

and then commit, push and pull into production. No need to unfreeze your bundle and no need to get your development and production repositories out of sync.