Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

rubygems - Rails: How can I remove default version of bundler?

I tried to change default bundle version but it getting updated with 2 default version. How can I modify to single default?

$ gem list bundler

*** LOCAL GEMS ***

bundler (2.0.1, default: 1.16.6, default: 1.16.2)

If I do gem uninstall not removing defaults,

$ gem uninstall bundler
Successfully uninstalled bundler-2.0.1


$ gem list bundle

*** LOCAL GEMS ***

bundler (default: 1.16.6, default: 1.16.2)

How can I set (like the below) default as single version?

bundler (2.0.1, default: 1.16.6)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I had the same problem but with a newer version

$ gem list bundler

*** LOCAL GEMS ***

bundler (default: 2.1.4, default: 2.1.2)

But after following indications on this post Two default versions of rake installed - how to delete one allowed me to deleted one.


You have to delete the .gemspec file corresponding to the default gem you want to delete.

So first, locate where those files are.

# I'm running RVM to manage my Ruby versions

~/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/specifications/default/

-rw-r--r--   1 myuser  staff  10731 Dec 26 17:22 bundler-2.1.2.gemspec
-rw-r--r--   1 myuser  staff  15134 Jan  7 17:30 bundler-2.1.4.gemspec

Delete the one you don't need.

$ rm ~/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/specifications/default/bundler-2.1.2.gemspec

Then install (or reinstall) the gem you want to set as default.

$ gem install bundler:2.1.4 --default

Successfully installed bundler-2.1.4 as a default gem

Finally you'll have installed only the version you wanted.

$ gem list bundler

*** LOCAL GEMS ***

bundler (default: 2.1.4)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...