为什么我的Rails服务器无法运行?

时间:2013-12-12 16:01:32

标签: ruby-on-rails ruby

当我尝试启动我的Rails服务器时,使用rails server命令,我收到很多错误。我该如何修理它们?

/home/action/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:205:in `parse': (<unknown>): mapping values are not allowed in this context at line 6 column 15 (Psych::SyntaxError)                                                          
    from /home/action/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:205:in `parse_stream'                                                                                                                                            
    from /home/action/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:153:in `parse'                                                                                                                                                   
    from /home/action/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:129:in `load'                                                                                                                                                    
    from /home/action/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/figaro-0.7.0/lib/figaro.rb:21:in `raw'                                                                                                                                    
    from /home/action/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/figaro-0.7.0/lib/figaro.rb:17:in `env'                                                                                                                                    
    from /home/action/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/figaro-0.7.0/lib/figaro/railtie.rb:7:in `block in <class:Railtie>'                                                                                                        
    from /home/action/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:36:in `call'                                                                                                    
    from /home/action/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'                                                                                            
    from /home/action/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'                                                                                 
    from /home/action/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:44:in `each'                                                                                                    
    from /home/action/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'                                                                                          
    from /home/action/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/railties-4.0.2/lib/rails/application.rb:67:in `inherited'                                                                                                                 
    from /home/action/workspace/learn-rails/config/application.rb:10:in `<module:LearnRails>'                                                                                                                                              
    from /home/action/workspace/learn-rails/config/application.rb:9:in `<top (required)>'                                                                                                                                                  
    from /home/action/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/railties-4.0.2/lib/rails/commands.rb:74:in `require'                                                                                                                      
    from /home/action/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/railties-4.0.2/lib/rails/commands.rb:74:in `block in <top (required)>'                                                                                                    
    from /home/action/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'                                                                                                                          
    from /home/action/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top (required)>'                                                                                                             
    from bin/rails:4:in `require'                                                                                                                                                                                                          
    from bin/rails:4:in `<main>' 

这是application.rb文件代码:

require File.expand_path('../boot', __FILE__)

require 'rails/all'

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)

module LearnRails
  class Application < Rails::Application
    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.

    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
    # config.time_zone = 'Central Time (US & Canada)'

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
    # config.i18n.default_locale = :de
  end
end

最后编辑

谢谢,这是app.yml文件的奇怪问题!现在它就像一个魅力!

1 个答案:

答案 0 :(得分:0)

这似乎与figaro gem一样错误。 Psych::SyntaxError表明您的application.yml文件可能存在问题。