當我嘗試啓動我的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文件!現在它就像一個魅力!
可能在某些yaml配置中出現語法錯誤? –
它告訴你在哪裏看:/home/action/workspace/learn-rails/config/application.rb:10:in''如果你不知道該在哪裏看,請發佈這個文件。 –
Severin
請發佈您的application.rb文件,因爲這是_probably_問題在哪裏(特別是第9或10行)。 – Donovan