我试图在Mac上安装Rails,但它不会让我

时间:2013-12-26 04:48:20

标签: ruby-on-rails ruby railsinstaller

我正在尝试在我的Mac上安装Rails,但是每当我尝试安装它时,我都会收到:

$ gem install rails

/Users/macbook/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/psych.rb:369:in `parse': (<unknown>): mapping values are not allowed in this context at line 2 column 4 (Psych::SyntaxError)
    from /Users/macbook/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/psych.rb:369:in `parse_stream'
    from /Users/macbook/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/psych.rb:317:in `parse'
    from /Users/macbook/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/psych.rb:244:in `load'
    from /Users/macbook/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/config_file.rb:332:in `load_file'
    from /Users/macbook/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/config_file.rb:197:in `initialize'
    from /Users/macbook/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/gem_runner.rb:74:in `new'
    from /Users/macbook/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/gem_runner.rb:74:in `do_configuration'
    from /Users/macbook/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/gem_runner.rb:39:in `run'
    from /Users/macbook/.rvm/rubies/ruby-2.1.0/bin/gem:21:in `<main>'

我已经搜索了几个小时试图解决这个问题,所以任何帮助都会非常感激。我认为这是一个简单的修复,所以请提前为这个简单的问题道歉。

1 个答案:

答案 0 :(得分:0)

可能是您正在使用更新版本的ruby,即今天刚刚发布的 2.1.0 rails 的相关宝石与它不完全兼容。

您可以通过 RMV ruby​​ 2.0.0 中安装 rails ,即

$ rvm install 2.0.0
$ rvm use 2.0.0
$ ruby -v 
# should retrun 2.0.0-p...
$ gem install rails