2013-12-12 36 views
-1

当我尝试启动我的Rails服务器时,使用rails server命令,我收到很多错误。我如何解决它们?为什么我的Rails服务器不工作?

/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/[email protected]/gems/figaro-0.7.0/lib/figaro.rb:21:in `raw'                                  
    from /home/action/.rvm/gems/[email protected]/gems/figaro-0.7.0/lib/figaro.rb:17:in `env'                                  
    from /home/action/.rvm/gems/[email protected]/gems/figaro-0.7.0/lib/figaro/railtie.rb:7:in `block in <class:Railtie>'                           
    from /home/action/.rvm/gems/[email protected]/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:36:in `call'                          
    from /home/action/.rvm/gems/[email protected]/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'                        
    from /home/action/.rvm/gems/[email protected]/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'                     
    from /home/action/.rvm/gems/[email protected]/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:44:in `each'                          
    from /home/action/.rvm/gems/[email protected]/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'                       
    from /home/action/.rvm/gems/[email protected]/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/[email protected]/gems/railties-4.0.2/lib/rails/commands.rb:74:in `require'                              
    from /home/action/.rvm/gems/[email protected]/gems/railties-4.0.2/lib/rails/commands.rb:74:in `block in <top (required)>'                          
    from /home/action/.rvm/gems/[email protected]/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'                               
    from /home/action/.rvm/gems/ruby-2.[email protected]/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 

最后的编辑

谢谢你,这件事很奇怪问题application.yml文件!现在它就像一个魅力!

+1

可能在某些yaml配置中出现语法错误? –

+0

它告诉你在哪里看:/home/action/workspace/learn-rails/config/application.rb:10:in''如果你不知道该在哪里看,请发布这个文件。 – Severin

+0

请发布您的application.rb文件,因为这是_probably_问题在哪里(特别是第9或10行)。 – Donovan

回答

0

这看起来像是一个figaro宝石的错误。 Psych::SyntaxError建议您的application.yml文件可能是问题。

+0

没必要说“看起来你已经解决了这个问题,忽略这个”。要么删除问题,要么保留它。告诉人们在阅读完之后忽略它并没有好处。 –

+0

好的,完成。删除了编辑行。 – CuriousMind

相关问题