无法加载此类文件 — ruby​​gems.rb

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25328019/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 23:51:46  来源:igfitidea点击:

cannot load such file — rubygems.rb

ruby-on-railsrubyterminalrvm

提问by Liana Kadisha

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.

要打开这个项目(狂欢),我需要使用 ruby​​-2.1.2。我安装了 ruby​​-2.1.0 和 ruby​​-2.1.2,但我认为 2.1.2 版本由于某种原因已损坏,我似乎无法使用它。

|~/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!

请帮忙!

采纳答案by Amr Arafat

Try this:

尝试这个:

rvm fix-permissions

rvm reinstall 2.1.2

回答by shinesecret

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

即使我今天也遇到了这个问题,但再次安装 Ruby 对我来说似乎并不合适,因为从昨天开始一切都对我来说运行良好

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

根据错误,我刚刚更新了 RubyGem,这对我来说效果很好。

gem install rubygems-update

update_rubygems

回答by zhirzh

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

损坏的红宝石问题,在 RVM 的情况下,可以通过一种非常简单但不整洁的方法解决 - rvm re-install
您需要删除 RVM 以及所有红宝石。
请参考这篇文章