mirror of
https://github.com/jbranchaud/til
synced 2026-01-02 22:58:01 +00:00
Add Regenerate Lock File With Newer Bundler as a Ruby TIL
This commit is contained in:
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
||||
|
||||
For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter).
|
||||
|
||||
_1710 TILs and counting..._
|
||||
_1711 TILs and counting..._
|
||||
|
||||
See some of the other learning resources I work on:
|
||||
|
||||
@@ -1445,6 +1445,7 @@ If you've learned something here, support my efforts writing daily TILs by
|
||||
- [Read The First Line From A File](ruby/read-the-first-line-from-a-file.md)
|
||||
- [Refer To Implicit Block Argument With It](ruby/refer-to-implicit-block-argument-with-it.md)
|
||||
- [Reference Hash Key With Safe Navigation](ruby/reference-hash-key-with-safe-navigation.md)
|
||||
- [Regenerate Lock File With Newer Bundler](ruby/regenerate-lock-file-with-newer-bundler.md)
|
||||
- [Rendering ERB](ruby/rendering-erb.md)
|
||||
- [Replace The Current Process With An External Command](ruby/replace-the-current-process-with-an-external-command.md)
|
||||
- [Require Entire Gemfile In Pry Session](ruby/require-entire-gemfile-in-pry-session.md)
|
||||
|
||||
34
ruby/regenerate-lock-file-with-newer-bundler.md
Normal file
34
ruby/regenerate-lock-file-with-newer-bundler.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# Regenerate Lock File With Newer Bundler
|
||||
|
||||
While upgrading to the latest Ruby version (4.0.0), I also wanted to upgrade the
|
||||
version of `bundler` that my project uses. This shows up at the bottom of the
|
||||
`Gemfile.lock` file as the `BUNDLED WITH` line. Despite installing the latest
|
||||
version of `bundler`, I get the following message when I try to install
|
||||
dependencies.
|
||||
|
||||
```bash
|
||||
$ bundle install
|
||||
|
||||
Bundler 4.0.3 is running, but your lockfile was generated with 2.6.2.
|
||||
Installing Bundler 2.6.2 and restarting using that version.
|
||||
...
|
||||
```
|
||||
|
||||
Instead, what we need to tell `bundle` to update the locked version of `bundler`
|
||||
in the `Gemfile.lock`.
|
||||
|
||||
```bash
|
||||
$ bundle update --bundler
|
||||
|
||||
Fetching gem metadata from https://rubygems.org/.........
|
||||
Resolving dependencies...
|
||||
Bundle updated!
|
||||
```
|
||||
|
||||
The `--bundler` flag for `bundle-update` says the following:
|
||||
|
||||
> Update the locked version of bundler to the invoked bundler version.
|
||||
|
||||
So we could pass a specific `bundler` version to that flag, but in this case I
|
||||
want to use the version I'm invoking it with which is the latest that I just
|
||||
installed.
|
||||
Reference in New Issue
Block a user