Rails:如何删除捆绑器的默认版本? [英] Rails: How can I remove default version of bundler?
问题描述
我尝试更改默认捆绑软件版本,但它已更新为2个默认版本.如何修改为单个默认值?
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)
如果我卸载gem不会删除默认值,
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)
推荐答案
我遇到了同样的问题,但是版本更新了
I had the same problem but with a newer version
$ gem list bundler
*** LOCAL GEMS ***
bundler (default: 2.1.4, default: 2.1.2)
但是在遵循此帖子的指示后已安装两个默认版本的rake-如何删除一个,允许我删除一个.
But after following indications on this post Two default versions of rake installed - how to delete one allowed me to deleted one.
您必须删除与要删除的默认gem对应的 .gemspec 文件.
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
删除不需要的内容.
$ rm ~/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/specifications/default/bundler-2.1.2.gemspec
然后安装(或重新安装)要设置为默认值的gem.
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)
这篇关于Rails:如何删除捆绑器的默认版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!