2013-08-02 105 views
1

Ruby on Rails新增的Mac OSX用户。我试图重新安装Ruby 2.0.0,因为RubyGem存在一些问题,导致我无法安装Rails。附近重新安装结束时,我得到了一个错误信息说RubyGem安装失败:尝试重新安装Ruby,但RubyGem未能安装

Removing /Users/yuanhunglo/.rvm/src/ruby-2.0.0-p0... 
Removing /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0... 
Searching for binary rubies, this might take some time. 
No binary rubies available for: osx/10.8/x86_64/ruby-2.0.0-p0. 
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies. 
Installing requirements for osx, might require sudo password. 
Certificates in '/Users/yuanhunglo/.rvm/etc/openssl/cert.pem' already are up to date. 
Requirements installation successful. 
Installing Ruby from source to: /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0, this may take a while depending on your cpu(s)... 
ruby-2.0.0-p0 - #downloading ruby-2.0.0-p0, this may take a while depending on your connection... 
ruby-2.0.0-p0 - #extracting ruby-2.0.0-p0 to /Users/yuanhunglo/.rvm/src/ruby-2.0.0-p0 
ruby-2.0.0-p0 - #extracted to /Users/yuanhunglo/.rvm/src/ruby-2.0.0-p0 
ruby-2.0.0-p0 - #configuring.................. 
ruby-2.0.0-p0 - #compiling..... 
ruby-2.0.0-p0 - #installing ................................................... 
Retrieving rubygems-2.0.6 
Extracting rubygems-2.0.6 ... 
Removing old Rubygems files... 
Installing rubygems-2.0.6 for ruby-2.0.0-p0................................................ 
Error running 'env GEM_PATH=/Users/yuanhunglo/.rvm/gems/ruby-2.0.0-p0:/Users/yuanhunglo/.rvm/gems/[email protected]:/Users/yuanhunglo/.rvm/gems/ruby-2.0.0-p0:/Users/yuanhunglo/.rvm/gems/[email protected] GEM_HOME=/Users/yuanhunglo/.rvm/gems/ruby-2.0.0-p0 /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/bin/ruby -d /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/setup.rb', 
please read /Users/yuanhunglo/.rvm/log/ruby-2.0.0-p0/1375477539_rubygems.install.log 
Installation of rubygems did not complete successfully. 
Saving wrappers to '/Users/yuanhunglo/.rvm/wrappers/ruby-2.0.0-p0'........... 

ruby-2.0.0-p0 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake). 
ruby-2.0.0-p0 - #importing default gemsets, this may take time............................... 
Install of ruby-2.0.0-p0 - #complete 
Making gemset ruby-2.0.0-p0 pristine................................................................................................................................................................................................................ 
Error running '__rvm_with ruby-2.0.0-p0 /Users/yuanhunglo/.rvm/scripts/gemsets pristine', 
please read /Users/yuanhunglo/.rvm/log/ruby-2.0.0-p0/1375477541_gemset.pristine-ruby-2.0.0-p0.log 
Making gemset [email protected] pristine................................................................................................................................................................................................................. 
Error running '__rvm_with [email protected] /Users/yuanhunglo/.rvm/scripts/gemsets pristine', 
please read /Users/yuanhunglo/.rvm/log/ruby-2.0.0-p0/[email protected] 
/Users/yuanhunglo/.rvm/src/ruby-2.0.0-p247 has already been removed. 
Removing /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p247... 
Searching for binary rubies, this might take some time. 
Installing requirements for osx, might require sudo password. 
Certificates in '/Users/yuanhunglo/.rvm/etc/openssl/cert.pem' already are up to date. 
Requirements installation successful. 
ruby-2.0.0-p247 - #configure 
ruby-2.0.0-p247 - #download 
ruby-2.0.0-p247 - #validate archive 
ruby-2.0.0-p247 - #extract 
ruby-2.0.0-p247 - #validate binary 
ruby-2.0.0-p247 - #setup 
Saving wrappers to '/Users/yuanhunglo/.rvm/wrappers/ruby-2.0.0-p247'........... 
ruby-2.0.0-p247 - #importing default gemsets, this may take time....................... 
Making gemset ruby-2.0.0-p247 pristine.... 
Making gemset [email protected] pristine.... 
Making gemset [email protected]_rails_4_0 pristine.... 

我不知道我是否需要安装或修改的东西。

这里的install.log的提前

[2013-08-02 14:05:39] /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/bin/ruby 
Exception `LoadError' at /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/rubygems.rb:1073 - cannot load such file -- rubygems/defaults/operating_system 
Exception `LoadError' at /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/rubygems.rb:1082 - cannot load such file -- rubygems/defaults/ruby 
Error loading RubyGems plugin "/Users/yuanhunglo/.rvm/gems/[email protected]/gems/rubygems-bundler-1.1.1/lib/rubygems_plugin.rb": cannot load such file -- openssl (LoadError) 
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:355: warning: already initialized constant Gem::Security::DIGEST_ALGORITHM 
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:355: warning: previous definition of DIGEST_ALGORITHM was here 
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:360: warning: already initialized constant Gem::Security::DIGEST_NAME 
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:360: warning: previous definition of DIGEST_NAME was here 
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:365: warning: already initialized constant Gem::Security::KEY_ALGORITHM 
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:365: warning: previous definition of KEY_ALGORITHM was here 
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:370: warning: already initialized constant Gem::Security::KEY_LENGTH 
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:370: warning: previous definition of KEY_LENGTH was here 
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:375: warning: already initialized constant Gem::Security::ONE_YEAR 
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:375: warning: previous definition of ONE_YEAR was here 
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:385: warning: already initialized constant Gem::Security::EXTENSIONS 
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:385: warning: previous definition of EXTENSIONS was here 
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require': cannot load such file -- openssl (LoadError) 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security/policy.rb:23:in `initialize' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security/policies.rb:6:in `new' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security/policies.rb:6:in `<module:Security>' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security/policies.rb:1:in `<top (required)>' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:583:in `<top (required)>' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/package.rb:43:in `<top (required)>' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/installer.rb:8:in `<top (required)>' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/request_set.rb:5:in `<top (required)>' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems.rb:200:in `finish_resolve' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/rdoc.rb:14:in `<top (required)>' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/uninstaller.rb:10:in `<top (required)>' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/commands/setup_command.rb:474:in `uninstall_old_gemcutter' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/commands/setup_command.rb:146:in `execute' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/command.rb:305:in `invoke_with_build_args' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/command_manager.rb:170:in `process_args' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/command_manager.rb:130:in `run' 
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/gem_runner.rb:60:in `run' 
    from setup.rb:45:in `<main>' 
RubyGems 2.0.6 installed 

许多感谢。

+0

为什么不显示此次安装的命令,并说明以前如何安装Ruby?这很可能是相关的。您可以使用'rvm implode'来清除RVM及其安装。并且,安装Ruby 2.0.0-p247而不是p0。 –

回答

2

看到这个问题:RVM ruby on rails issue OpenSSLhttp://www.dinduks.com/rails-cannot-load-such-file-openssl/

卸载RVM,从将OpenSSL安装,安装RVM


说明

这个错误意味着你的Ruby没有与OpenSSL的编译。

假设您使用RVM,这些是要解决此问题的步骤。

安装OpenSSL包

rvm pkg install openssl 

删除Ruby安装你使用

rvm remove 1.9.3 

最后使用OpenSSL编译红宝石

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

一切都应该现在工作。不要忘了:

RVM使用1.9.3 --default


附注:我建议安装rbenv代替RVM。

+0

谢谢。尽管该帖子中的链接已被破坏,但我按照指示操​​作 - 安装openssl,然后卸载Ruby并重新编译 - 在[site]上(http://www.dinduks.com/rails-cannot-load-such-file -openssl /)并且能够解决问题。也就是说,我所做的: 'RVM PKG安装OpenSSL的 RVM删除1.9.3 RVM安装1.9.3 --with-的OpenSSL DIR = $ HOME/.rvm在/ usr RVM使用1.9.3 --default' – mlo

+0

很酷,我为未来的访问者添加了说明。 –