RubyGems error after updating system

谁说胖子不能爱 提交于 2019-12-05 01:22:05

what do you get when you try to list your gems.. is json >= 1.4 there?

e.g.:

> gem list json

*** LOCAL GEMS ***

json (1.6.1, 1.5.4, 1.5.3, 1.5.1, 1.4.2)
json_pure (1.6.1, 1.5.4, 1.5.3)

if you use RVM gemsets, you may want to list them also, to check if your default gemset has changed:

rvm gemset list

EDIT: Mystery Solved! :-)

you accidentially installed your gems with sudo -- but you have RVM installed for your user account!

When you have RVM installed for an individual user, it's generally not a good idea to do sudo gem install ... , but you should install the gems just for the local user and let RVM manage them for whatever Ruby version you are using.

If you still install with sudo, RVM will not find the gems, because they are stored in a different location, outside of RVM, and not searched by RVM...! Looks like that's the case you experienced.

Check this RailsCast: http://railscasts.com/episodes/200-rails-3-beta-and-rvm

if you're using Rails: - edit your Gemfile and add the json dependency , then run bundle install

if you're just using Ruby by itself, or an old version or Ruby: - run gem install json in the shell

With newer Ruby versions you should not manually install the gems

Add gem "json", "~> 1.4" in your Gemfile and run bundle install

Also

You only use the sudo command during the install process. In Multi-User configurations, any operations which require sudo access must use the rvmsudo command which preserves the RVM environment and passes this on to sudo. There are very few cases where rvmsudo is required once the core install is completed, except for when updating RVM itself. There is never a reason to use sudo post-install. Once users added to the 'rvm' group have logged out, then back in to gain rvm group membership, rvmsudo should only be needed for updating RVM itself with

rvmsudo rvm get head

Please read the https://rvm.beginrescueend.com/support/troubleshooting/ page The installer page also details this for new installations. You will need to remove your existing installation and redo it in order to properly reconfigure the permissions. In the future, never user sudo when working on your RVM installation, except when installing. Any other commands will not require sudo use except for

rvmsudo rvm get head

to update your installation. If the users are properly placed in the rvm group as detailed on the site, you will have no need to use sudo at all, and rvmsudo only for updating.

Also, RVM does not manage the system installed ruby at all! We do provide the use of

rvm use system

in order to give a natural way to switch between RVM controlled rubies, and the system. Your package manager, or lack thereof for OS X, is responsible for managing your system installed ruby and is outside the control of RVM 100%.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!