我如何删除默认的宝石? !想要卸载json的gem 1.7.7版本 [英] how can i remove a default gem? ! want to uninstall a gem 1.7.7 version of json

查看:873
本文介绍了我如何删除默认的宝石? !想要卸载json的gem 1.7.7版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在OSX和Ubuntu上有相同的Rails应用程序,我想用Zeus来加速我的rspec。
在Ubuntu中,Zeus开始OK,但在OSX中它总是崩溃。
最后我发现这个问题, https://github.com/ burke / zeus / issues / 237#issuecomment-18700462 OSX和Ubuntu的区别在于json gem的版本。
我使用 gem list | grep json
Ubuntu显示

I have the same rails app in OSX and Ubuntu, i want to use Zeus to speed up my rspec. In Ubuntu, Zeus starts Ok, but in OSX it always be crashed. At last i find the issue, https://github.com/burke/zeus/issues/237#issuecomment-18700462 the difference between OSX and Ubuntu is the version of json gem. I use gem list | grep json Ubuntu shows

json (1.8.1, 1.8.0, 1.5.3)
json_pure (1.5.3)
json_spec (1.1.1)
jsonpath (0.5.3)
multi_json (1.8.2, 1.7.8, 1.0.3)

Mac显示

Mac shows

json (1.8.1, 1.7.7)
json_spec (1.1.1)
jsonpath (0.5.5, 0.5.3)
multi_json (1.8.2, 1.7.8)

所以我想卸载1.7.7版本的json gem来让zeus启动,但是

so i want to uninstall 1.7.7 version of json gem to make zeus start, but

gem uninstall json -v 1.7.7
ERROR:  While executing gem ... (Gem::InstallError)
gem "json" cannot be uninstalled because it is a default gem

我应该怎么做做?任何帮助,将不胜感激!

What should i do? Any help will be appreciated!

推荐答案

所以基于我可以告诉有没有简单的命令,可以将gemspec文件从默认文件夹设置为无默认文件夹。从我所知道的情况来看,这是一件好事,但这里是说明如何手动做到这一点。

So based off what I can tell there is no easy command that can move the gemspec file from the default folder to the no default folder. This is a good thing from what I can tell but here is the instructions how to do this by hand.


  1. 查找默认规格的位置。 Easies的方法是进入 irb 并运行下面的命令

irb(main):001:0> File.join Gem::Specification.default_specifications_dir
=> "/Users/newdark/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/specifications/default"


这是构建gemspec路径的代码行
https://github.com/rubygems/rubygems/blob/v2.6.13/lib/rubygems/installer.rb #L420

This is the line of code that builds the gemspec path https://github.com/rubygems/rubygems/blob/v2.6.13/lib/rubygems/installer.rb#L420


  1. 获取文件路径后,您只需移动gem名称和版本从默认文件夹到父文件夹。

  1. Once you get the file path you just need to move the gem name and version from the default folder to the parent folder.

$ cd /Users/newdark/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/specifications/default
$ mv json-1.7.7.gemspec ../


如果您执行 gem list -d ,则不应再看到字样(默认) code>在gem版本json-1.7.7旁边。然后你可以运行 gem uninstall json -v 1.7.7 ,这样它就可以与你战斗。如果你想撤消所有这些,只需运行 gem install json -v 1.7.7 --default

if you do gem list -d you should no longer see the words Installed at (default) next to the gem version json-1.7.7. you can then run gem uninstall json -v 1.7.7 with out it fighting you. If you want to undo all this just run gem install json -v 1.7.7 --default

这篇关于我如何删除默认的宝石? !想要卸载json的gem 1.7.7版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆