无法安装JSON宝石 [英] Can't install JSON gem
问题描述
在任何源代码中找不到json-1.4.6
我跑了 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/$c$ C>。运行
),这不仅更安全,而且更少打字。 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屋!