repository The specified gem is bundle installed but not updated to the latest version

TL;DR

If the gemfile has not been updated, you will go to see the commit hash of revision in gemfile.lock.

console


bundle update gem-name

let's do it

problem

When I went to fork-> PR-> merge to the library used in the company and tried to check it, it was said that the method that should have been added was undefined.

What was solved

First check what you can use

rails_console


# respond_to?Is the one that checks if a method exists
GemName respond_to? :configure #-> true
GemName respond_to? :new_added_method #-> false

#I noticed that there is no method that I should have entered in PR and check if the gem itself is included without problems
GemName.added_a_lomng_time_ago_method #->Passed

Here, I noticed that the contents of the PR were not completely included and considered that the HEAD might be off.

console


git clone [email protected]:my-org/gem-name #Clone the original repository instead of fork
git rev-parse HEAD #-> 00ff0012345
git rev-parse master #-> 00ff0012345(Confirm that it is the same as HEAD)

Specify gem with commit hash as a trial because it is not misaligned

gemfile


gem 'gem-name', git: '[email protected]:my-org/gem-name', ref: '00ff0012345'

#bundle install

rails_console


GemName.new_added_method #->I passed!

So, when I checked gemfile.lock, revision changed. This is the cause …………

After this

gemfile


gem 'gem-name', git: '[email protected]:my-org/gem-name', branch: 'master'

But there was no problem. Well, it is expected because revision became HEAD when commit hash was specified.

What to do

Well, install is done based on gemfile.lock, so it is natural to say, but I had to use bundle update. I was completely distracted by the fact that I specified the repository directly and completely forgot. If you want to update at the same time as bundle install, you need to create an executable file to do it all at once.

Reference: https://stackoverflow.com/questions/8324334/bundler-always-use-latest-revision-of-git-branch-in-gemfile

Recommended Posts

repository The specified gem is bundle installed but not updated to the latest version
What to do if the app is not created with the latest Rails version installed when rails new
I specified the version and rails new, but for some reason the latest version is included ~
What to do if you installed Ruby with rbenv but the version does not change
[Ruby] Your Ruby version is 2.6.3, but your Gemfile specified 2.5.8
Your Ruby version is 2.4.6, but your Gemfile specified 2.6.4
[Swift] What to do if the app icon is set but not reflected
The public key for jenkins-2.249.1-1.1.noarch.rpm is not installed
[Ruby] How to use rbenv (version `x.x.x'is not installed)
Suddenly bundle install is not possible due to gem'ffi'
[Ruby] The gem should have been installed in vendor / bundle, but an error occurs in require
Yarn is not installed
Gemfile.lock doesn't say the version of gem you have installed
What to do if FacesMessage is set but not displayed
Update to the latest version without specifying the version with gradle wrapper
[Note] What to do if bundle install in Chapter 3 of the rails tutorial is not possible