cannot load such file — rubygems.rb

大城市里の小女人 提交于 2019-11-29 12:43:31

问题


To open this project (revel) I need to be using ruby-2.1.2. I have both ruby-2.1.0 and ruby-2.1.2 installed, but I think the 2.1.2 version is corrupt for some reason and I can't seem to use it.

|~/desktop/ix/projects/revel> rvm use 2.1.2
Using /Users/lianoosh/.rvm/gems/ruby-2.1.2
<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
    from <internal:gem_prelude>:1:in `<compiled>'

|~/desktop/ix/projects/revel> gem list
<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
    from <internal:gem_prelude>:1:in `<compiled>'

|~/desktop/ix/projects/revel> gem update --system 
<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
    from <internal:gem_prelude>:1:in `<compiled>'

When I tried to uninstall to reinstall I get:

|~/desktop/ix/projects/revel> rvm uninstall 2.1.2
ruby-2.1.2 - #removing rubies/ruby-2.1.2............................................................................................................................|
Error running '__rvm_rm_rf /Users/lianoosh/.rvm/rubies/ruby-2.1.2',
showing last 15 lines of /Users/lianoosh/.rvm/log/1408110977_ruby-2.1.2/remove.rubies.log
rm: /Users/lianoosh/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/tzinfo-1.2.1/test/zoneinfo: Permission denied
rm: /Users/lianoosh/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/tzinfo-1.2.1/test: Permission denied
rm: /Users/lianoosh/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/tzinfo-1.2.1/tzinfo.gemspec: Permission denied
rm: /Users/lianoosh/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/tzinfo-1.2.1: Directory not empty
rm: /Users/lianoosh/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems: Directory not empty
rm: /Users/lianoosh/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0: Directory not empty
rm: /Users/lianoosh/.rvm/rubies/ruby-2.1.2/lib/ruby/gems: Directory not empty
rm: /Users/lianoosh/.rvm/rubies/ruby-2.1.2/lib/ruby: Directory not empty
rm: /Users/lianoosh/.rvm/rubies/ruby-2.1.2/lib: Directory not empty
rm: /Users/lianoosh/.rvm/rubies/ruby-2.1.2: Directory not empty
++ typeset ret=1
++ rvm_debug '__rvm_rm_rf error removing target dir '\''/Users/lianoosh/.rvm/rubies/ruby-2.1.2'\''.'
++ ((  0  ))
++ return 0
++ return 1

Then:

|~/desktop/ix/projects/revel> rvm list

rvm rubies

   ruby-2.1.0 [ x86_64 ]
=* ruby-2.1.2 [ missing bin/ruby ]

# => - current
# =* - current && default
#  * - default

So when I try to reinstall I get:

Already installed ruby-2.1.2.
To reinstall use:

    rvm reinstall ruby-2.1.2

And when I do that I get a bunch of permission denied messages and directory not empty and go right back to where I started. Also:

Empty path passed to certificates update, functions stack: requirements_osx_update_openssl_cert_run rvm_requiremnts_fail_or_run_action __rvm_osx_ssl_certs_ensure_for_ruby __rvm_osx_ssl_certs_ensure_for_ruby_except_jruby external_import_setup external_import main

Please help!


回答1:


Try this:

rvm fix-permissions

rvm reinstall 2.1.2



回答2:


Even I faced this issue today but installing Ruby again does not seem right to me as everything was working well for me since yesterday

As per the error I just updated RubyGem and that worked well for me.

gem install rubygems-update

update_rubygems



回答3:


Issues with broken rubies, in case of RVM can be solved in a very simple yet untidy method - rvm re-install
You need to remove RVM, along with all the rubies.
Please refer to this article



来源:https://stackoverflow.com/questions/25328019/cannot-load-such-file-rubygems-rb

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