7

运行时rvm rubygems latest出现错误。怎么修?

Error running 'env GEM_PATH=/Users/sjc/.rvm/gems/ruby-2.0.0-p0:/Users/
sjc/.rvm/gems/ruby-2.0.0-p0@global:/Users/sjc/.rvm/gems/ruby-2.0.0-p0:
/Users/sjc/.rvm/gems/ruby-2.0.0-p0@global GEM_HOME=/Users/sjc/.rvm/gem
s/ruby-2.0.0-p0 /Users/sjc/.rvm/rubies/ruby-2.0.0-p0/bin/ruby /Users/s
jc/.rvm/src/rubygems-2.0.0/setup.rb', please read /Users/sjc/.rvm/log/
ruby-2.0.0-p0/rubygems.install.log

日志(rubygems.install.log)有这个:

[2013-03-05 20:31:37] /Users/sjc/.rvm/rubies/ruby-2.0.0-p0/bin/ruby
/Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- openssl (LoadError)
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/security.rb:8:in `<top (required)>'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/package.rb:43:in `<top (required)>'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/installer.rb:8:in `<top (required)>'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/request_set.rb:5:in `<top (required)>'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems.rb:195:in `finish_resolve'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/rdoc.rb:14:in `<top (required)>'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/uninstaller.rb:10:in `<top (required)>'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/core_ext/kernel_require.rb:45:in `require'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/commands/setup_command.rb:440:in `uninstall_old_gemcutter'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/commands/setup_command.rb:144:in `execute'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/command.rb:305:in `invoke_with_build_args'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/command_manager.rb:170:in `process_args'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/command_manager.rb:130:in `run'
    from /Users/sjc/.rvm/src/rubygems-2.0.0/lib/rubygems/gem_runner.rb:60:in `run'
    from setup.rb:45:in `<main>'
RubyGems 2.0.0 installed

因为我不知道自己在做什么,所以我认为我之前安装 sass 的尝试可能导致了这种情况。我遵循了这些说明,因此在当天早些时候执行了这些命令。

$ export GEM_HOME=/home/mygemrepository
$ ruby setup.rb --prefix=/home/mystuff

同样,我不认为这很重要,因为 GEM_HOME 和 GEM_PATH 似乎正确。

$ echo $GEM_HOME
/Users/sjc/.rvm/gems/ruby-2.0.0-p0
$ echo $GEM_PATH
/Users/sjc/.rvm/gems/ruby-2.0.0-p0:/Users/sjc/.rvm/gems/ruby-2.0.0-p0@global 
4

3 回答 3

7

看起来你缺少 openssl。结帐:https ://rvm.io/packages/openssl/

于 2013-03-06T05:27:27.647 回答
6

ruby 2.3.1 的示例,或者可能是其他版本的 ruby​​。

无需重新安装 rvm:

rvm pkg install openssl
rvm install 2.3.1 --with-openssl-dir=$HOME/.rvm/usr

或者重新安装 rvm:

rvm implode
\curl -sSL https://get.rvm.io | bash
rvm pkg install openssl
rvm install 2.3.1 --with-openssl-dir=$HOME/.rvm/usr

或者使用 ruby​​ < 2.3 的自定义 ruby​​gems:

rvm pkg install openssl
rvm install 2.2.2 --rubygems 2.7.10 --with-openssl-dir=$HOME/.rvm/usr

PS:毕竟可能要重新安装所有的ruby版本

rvm reinstall all --force
于 2020-05-04T20:14:26.187 回答
0

另一个可能的问题是您的默认 Ruby 版本是否过时。

大多数操作系统都预装了 Ruby,但使用的是旧版本的 Ruby (1.8.x),而不是 2.x 甚至 1.9.x,这可能会导致新版本的 rvm 失败。

$ rvm list 查看安装的 ruby​​ 版本列表,并使用(“ruby use uby-1.9.3-p429”等效项)进行设置,然后尝试: $ rvm get stable(获取最新的错误修复和 ruby​​ 版本更新) $ rvm ruby​​gems 最新

我还更改了默认的 ruby​​:$ rvm --default use 1.9.2

为我工作!

于 2014-03-24T15:46:04.537 回答