2013-07-29 183 views
1

我正在處理我的第一個Rails應用程序。我剛剛從Rails 3.2.13更新到Rails 4,現在我試圖安裝ruby 2.0.0,但是我整天都陷入了同樣的錯誤。我在這裏發現了幾個關於SO和其他地方的問題,其中許多都有可接受的答案,但根本沒有任何解決方案適用於我。嘗試使用RVM安裝Ruby 2.0.0時安裝rubygems失敗

最後,我最終完全刪除了所有ruby版本並完全刪除rvm,但即使試圖從頭重新安裝也會導致相同的錯誤。我在OSX 10.8.4上。

錯誤

Extracting rubygems-2.0.6 ... 
Removing old Rubygems files... 
Installing rubygems-2.0.6 for ruby-2.0.0-p247...................... 
Error running 'env GEM_PATH=/Users/arielpontes/.rvm/gems/ruby-2.0.0-p247:/Users/arielpontes/.rvm/gems/[email protected]:/Users/arielpontes/.rvm/gems/ruby-2.0.0-p247:/Users/arielpontes/.rvm/gems/[email protected] GEM_HOME=/Users/arielpontes/.rvm/gems/ruby-2.0.0-p247 /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/bin/ruby -d /Users/arielpontes/.rvm/src/rubygems-2.0.6/setup.rb', 
please read /Users/arielpontes/.rvm/log/ruby-2.0.0-p247/1375132582_rubygems.install.log 
Installation of rubygems did not complete successfully. 
Saving wrappers to '/Users/arielpontes/.rvm/wrappers/ruby-2.0.0-p247'... 

日誌

[2013-07-29 18:23:54] /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/bin/ruby 
Exception `LoadError' at /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems.rb:1082 - cannot load such file -- rubygems/defaults/operating_system 
Exception `LoadError' at /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems.rb:1091 - cannot load such file -- rubygems/defaults/ruby 
/Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/yaml.rb:4:in `<top (required)>': 
It seems your ruby installation is missing psych (for YAML output). 
To eliminate this warning, please install libyaml and reinstall your ruby. 
/Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require': dlopen(/Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin12.4.0/psych.bundle, 9): Library not loaded: /usr/local/opt/libyaml/lib/libyaml-0.2.dylib (LoadError) 
    Referenced from: /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin12.4.0/psych.bundle 
    Reason: image not found - /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin12.4.0/psych.bundle 
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require' 
    from /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:1:in `<top (required)>' 
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require' 
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require' 
    from /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/yaml.rb:5:in `<top (required)>' 
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require' 
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require' 
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems.rb:600:in `load_yaml' 
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/config_file.rb:313:in `load_file' 
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/config_file.rb:190:in `initialize' 
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/gem_runner.rb:66:in `new' 
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/gem_runner.rb:66:in `do_configuration' 
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/gem_runner.rb:46:in `run' 
    from setup.rb:45:in `<main>' 

任何人有什麼我可以做些什麼來解決這個問題的任何想法?我試過解決方案this question但無濟於事。謝謝。

回答

6

那麼,我終於設法修復它!對不起,如果我結束了污染SO。無論如何,我會回覆我的問題,以防有人遇到類似的問題,並在未來結束。

原來,根據Homebrew的說法,我搞錯了安裝libyaml「已安裝但未連接」。在嘗試this solution後我想通了。所以我卸載libyaml並用sudo rm -rf殺死它並重新安裝。我碰到了this problem,但接受的答案解決了它。在此之後,我使用穩定的紅寶石從頭開始安裝RVM,並且它終於奏效了!

+1

Whe。很高興我找到了這個。幾個小時後,我的頭靠在牆上。 –