rbenv default bundler gem 기본 버전 변경안될 때

Kyu·2021년 1월 22일
0

For those who use rbenv, let say by accidentally you have two default versions

$ gem list | grep bundler
bundler (default: 2.1.4, default: 1.17.2)

Check your gem installation path

$ gem environment
RubyGems Environment:
.
.
- INSTALLATION DIRECTORY: /home/yohanes/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0
.

Go to the specifications/default directory and look for bundlers gemspec

$ cd /home/yohanes/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/specifications/default
$ ls -lah
total 200K
drwxr-xr-x 2 yohanes yohanes 4,0K Jun  1 10:05 .
drwxr-xr-x 3 yohanes yohanes  20K Jun  1 10:05 ..
.
.
-rw-r--r-- 1 yohanes yohanes  16K Jun  1 10:05 bundler-1.17.2.gemspec
-rw-r--r-- 1 yohanes yohanes  15K Jun  1 09:31 bundler-2.1.4.gemspec
.

.
Remove the version that you need to remove

$ rm bundler-2.1.4.gemspec

Check again

$ gem list | grep bundler
bundler (default: 1.17.2)

$ gem list bundler

*** LOCAL GEMS ***

bundler (default: 1.17.2)

but, if you check bundle version, you still get the deleted version as default

$ bundler -v
Bundler version 2.1.4

So we have to overrides it by reinstalling the required bundler version again

$ gem install bundler --version '1.17.2'
Successfully installed bundler-1.17.2
Parsing documentation for bundler-1.17.2
Done installing documentation for bundler after 1 seconds
1 gem installed

Then, if you check again it will show you the desired version

$ bundle -v
Bundler version 1.17.2

https://stackoverflow.com/questions/57306611/how-can-i-remove-default-version-of-bundler

profile
TIL 남기는 공간입니다

0개의 댓글