无法安装JSON宝石 [英] Can't install JSON gem

查看:163
本文介绍了无法安装JSON宝石的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在任何源代码中找不到json-1.4.6

code>



我跑了 gem install json bundle install 但我只能在需要json-1.4.6时安装json-1.5.1



我有 gem'json ','1.4.6'在我的gemfile中,所以我不确定发生了什么...



更新



我得到这个错误:

安装json(1.4.6)/System/Library/Frameworks/Ruby.framework/Versions /1.8/usr/lib/ruby/1.8/fileutils.rb:1216:in`chmod':不允许操作 - /Library/Ruby/Gems/1.8/gems/json-1.4.6/CHANGES(Errno :: EPERM)

解决方案

为什么运行 gem install json Bundler会为您提供帮助,并确保安装每个gem的正确版本(因为有时候依赖项需要更早的版本)。 Run

  gem uninstall json 
bundle install

还要确保你的Gemfile顶部有 source'https://rubygems.org'



至于权限信息,您可能需要运行 gem bundle > sudo



顺便说一下,我很高查看并使用 RVM ,特别是 gemsets 功能。它会让你的生活在开发Ruby应用程序时变得更好。如果您决定这么做,我还会建议使用系统Ruby来破坏所有安装的gem,方法是运行 sudo rm -rf /Library/Ruby/Gems/1.8/。运行 gem (或<$ c $>时使用RVM时,您不必使用 sudo c> bundle ),这不仅更安全,而且更少打字。


I need to install json because I get this error:

Could not find json-1.4.6 in any of the sources

I ran gem install json and bundle install but I was only able to install json-1.5.1 when I need json-1.4.6

I have gem 'json', '1.4.6' in my gemfile, so I'm not sure what's going on...

UPDATE

I get this error:

Installing json (1.4.6) /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1216:in `chmod': Operation not permitted - /Library/Ruby/Gems/1.8/gems/json-1.4.6/CHANGES (Errno::EPERM)

解决方案

Why did you run gem install json at all? Bundler takes care of that for you and will ensure that the correct version of each gem is installed (since sometimes dependencies require an older version). Run

gem uninstall json
bundle install

Also ensure you have source 'https://rubygems.org' at the top of your Gemfile.

As for the permissions info, you may have to run gem and bundle commands with sudo.

By the way, I highly recommend taking a look at and using RVM, particularly the gemsets feature. It will make your life infinitely better when developing Ruby apps. If you decide to do so, I'd also suggest trashing all the gems you've install using the system Ruby by running sudo rm -rf /Library/Ruby/Gems/1.8/. It's also important that when using RVM you don't have to use sudo when running gem (or bundle), which is not only safer but less typing too.

这篇关于无法安装JSON宝石的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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