使用RVM在rails上安装ruby的问题

时间:2016-03-16 04:43:35

标签: ruby-on-rails ruby openssl rvm

我做了一些非常错误的事情,无法弄清楚我做了什么或者是怎么做的。我突然开始得到OPENssl证书错误:

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

所以我按照此链接中的说明寻求帮助:http://railsapps.github.io/openssl-certificate-verify-failed.html

在某些时候我必须删除rails,因为当我运行rails s时,我得到:

Rails is not currently installed on this system. To get the latest version, simply type:

    $ sudo gem install rails

现在当我运行sudo gem install rails时出现错误:

<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
    from <internal:gem_prelude>:1:in `<compiled>'

然后,为了尝试完成这项工作,我尝试重新安装rvm:

$ \curl -L https://get.rvm.io | bash -s stable

但这给了我一长串问题(我不明白......):

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   184  100   184    0     0    847      0 --:--:-- --:--:-- --:--:--   851
100 22865  100 22865    0     0  53451      0 --:--:-- --:--:-- --:--:--  114k
Downloading https://github.com/rvm/rvm/archive/1.26.11.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.26.11/1.26.11.tar.gz.asc
Found PGP signature at: 'https://github.com/rvm/rvm/releases/download/1.26.11/1.26.11.tar.gz.asc',
but no GPG software exists to validate it, skipping.

Upgrading the RVM installation in /Users/cyrusghazanfar/.rvm/
    RVM PATH line found in /Users/cyrusghazanfar/.mkshrc /Users/cyrusghazanfar/.profile /Users/cyrusghazanfar/.bashrc /Users/cyrusghazanfar/.zshrc.
    RVM sourcing line found in /Users/cyrusghazanfar/.profile /Users/cyrusghazanfar/.bash_profile /Users/cyrusghazanfar/.zlogin.
    Installing rvm gem in 2 gemsetsError running 'command gem install /Users/cyrusghazanfar/.rvm/gem-cache/rvm-1.11.3.9.gem --local --no-ri --no-rdoc',
showing last 15 lines of /Users/cyrusghazanfar/.rvm/log/1458102835_ruby-2.1.0/gem.install.rvm->=1.11.3.9.log
[2016-03-16 00:33:55] command
current path: /Users/cyrusghazanfar/.rvm/src/rvm
GEM_HOME=/Users/cyrusghazanfar/.rvm/gems/ruby-2.1.0@global
PATH=/Users/cyrusghazanfar/.rvm/gems/ruby-2.1.0@global/bin:/Users/cyrusghazanfar/.rvm/rubies/ruby-2.1.0/bin:/Users/cyrusghazanfar/.rvm/bin:/Users/cyrusghazanfar/anaconda/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/usr/local:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/ImageMagick/bin
GEM_PATH=/Users/cyrusghazanfar/.rvm/gems/ruby-2.1.0@global
command(7): command gem install /Users/cyrusghazanfar/.rvm/gem-cache/rvm-1.11.3.9.gem --local --no-ri --no-rdoc
+ ./scripts/functions/utility_logging : __rvm_log_dotted()  210 > gem install /Users/cyrusghazanfar/.rvm/gem-cache/rvm-1.11.3.9.gem --local --no-ri --no-rdoc
<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
    from <internal:gem_prelude>:1:in `<compiled>'
Error running 'command gem install /Users/cyrusghazanfar/.rvm/gem-cache/rvm-1.11.3.9.gem --local --no-ri --no-rdoc',
showing last 15 lines of /Users/cyrusghazanfar/.rvm/log/1458102835_ruby-2.2.1/gem.install.rvm->=1.11.3.9.log
[2016-03-16 00:33:55] command
current path: /Users/cyrusghazanfar/.rvm/src/rvm
GEM_HOME=/Users/cyrusghazanfar/.rvm/gems/ruby-2.2.1@global
PATH=/Users/cyrusghazanfar/.rvm/gems/ruby-2.2.1@global/bin:/Users/cyrusghazanfar/.rvm/rubies/ruby-2.2.1/bin:/Users/cyrusghazanfar/.rvm/bin:/Users/cyrusghazanfar/anaconda/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/usr/local:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/ImageMagick/bin
GEM_PATH=/Users/cyrusghazanfar/.rvm/gems/ruby-2.2.1@global
command(7): command gem install /Users/cyrusghazanfar/.rvm/gem-cache/rvm-1.11.3.9.gem --local --no-ri --no-rdoc
+ ./scripts/functions/utility_logging : __rvm_log_dotted()  210 > gem install /Users/cyrusghazanfar/.rvm/gem-cache/rvm-1.11.3.9.gem --local --no-ri --no-rdoc
<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
    from <internal:gem_prelude>:1:in `<compiled>'
.
    Installing gem-wrappers gem in 2 gemsetsError running 'command gem install /Users/cyrusghazanfar/.rvm/gem-cache/gem-wrappers-1.2.7.gem --local --no-ri --no-rdoc',
showing last 15 lines of /Users/cyrusghazanfar/.rvm/log/1458102835_ruby-2.1.0/gem.install.gem-wrappers->=1.2.7.log
[2016-03-16 00:33:55] command
current path: /Users/cyrusghazanfar/.rvm/src/rvm
GEM_HOME=/Users/cyrusghazanfar/.rvm/gems/ruby-2.1.0@global
PATH=/Users/cyrusghazanfar/.rvm/gems/ruby-2.1.0@global/bin:/Users/cyrusghazanfar/.rvm/rubies/ruby-2.1.0/bin:/Users/cyrusghazanfar/.rvm/bin:/Users/cyrusghazanfar/anaconda/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/usr/local:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/ImageMagick/bin
GEM_PATH=/Users/cyrusghazanfar/.rvm/gems/ruby-2.1.0@global
command(7): command gem install /Users/cyrusghazanfar/.rvm/gem-cache/gem-wrappers-1.2.7.gem --local --no-ri --no-rdoc
+ ./scripts/functions/utility_logging : __rvm_log_dotted()  210 > gem install /Users/cyrusghazanfar/.rvm/gem-cache/gem-wrappers-1.2.7.gem --local --no-ri --no-rdoc
<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
    from <internal:gem_prelude>:1:in `<compiled>'
Error running 'command gem install /Users/cyrusghazanfar/.rvm/gem-cache/gem-wrappers-1.2.7.gem --local --no-ri --no-rdoc',
showing last 15 lines of /Users/cyrusghazanfar/.rvm/log/1458102835_ruby-2.2.1/gem.install.gem-wrappers->=1.2.7.log
[2016-03-16 00:33:55] command
current path: /Users/cyrusghazanfar/.rvm/src/rvm
GEM_HOME=/Users/cyrusghazanfar/.rvm/gems/ruby-2.2.1@global
PATH=/Users/cyrusghazanfar/.rvm/gems/ruby-2.2.1@global/bin:/Users/cyrusghazanfar/.rvm/rubies/ruby-2.2.1/bin:/Users/cyrusghazanfar/.rvm/bin:/Users/cyrusghazanfar/anaconda/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/usr/local:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/ImageMagick/bin
GEM_PATH=/Users/cyrusghazanfar/.rvm/gems/ruby-2.2.1@global
command(7): command gem install /Users/cyrusghazanfar/.rvm/gem-cache/gem-wrappers-1.2.7.gem --local --no-ri --no-rdoc
+ ./scripts/functions/utility_logging : __rvm_log_dotted()  210 > gem install /Users/cyrusghazanfar/.rvm/gem-cache/gem-wrappers-1.2.7.gem --local --no-ri --no-rdoc
<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
    from <internal:gem_prelude>:1:in `<compiled>'
.
    Regenerating gem wrappers in 2 rubies<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
    from <internal:gem_prelude>:1:in `<compiled>'
<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
    from <internal:gem_prelude>:1:in `<compiled>'
<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
    from <internal:gem_prelude>:1:in `<compiled>'
<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
    from <internal:gem_prelude>:1:in `<compiled>'
.
Upgrade of RVM in /Users/cyrusghazanfar/.rvm/ is complete.

# cyzanfar,
#
#   Thank you for using RVM!
#   We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team.

In case of problems: http://rvm.io/help and https://twitter.com/rvm_io

Upgrade Notes:

  * No new notes to display.

请帮我调试一下。

更新

OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE添加到我的config/environments/development.rb解决了这个问题,但我是否需要为我构建的每个应用都这样做?有没有办法全局配置OpenSSL证书?

1 个答案:

答案 0 :(得分:0)

您可能安装了两个版本的ruby。检查使用:

which -a ruby

删除所有版本的ruby,使用软件包管理器重新安装,然后重新安装rubygems。