2016-09-09 3 views
1

mongodb/mongoidといくつかの追加mongodb/mongoid gems :私はそれを実行しようとしているときにMongodb/mongoid rails project - "8行目の7列目のブロックマッピングを解析中に期待されたキーが見つかりませんでした"(Psych :: SyntaxError)

ruby "2.3.1" 
gem 'rails', '4.1.1' 
gem 'mongoid' 

、私は例外を取得:

$ bundle exec rails s 
/home/alex/.gem/ruby/2.3.1/gems/activesupport-4.1.1/lib/active_support/values/time_zone.rb:285: warning: circular argument reference - now 
=> Booting Thin 
=> Rails 4.1.1 application starting in development on http://0.0.0.0:3000 
=> Run `rails server -h` for more startup options 
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option) 
=> Ctrl-C to shutdown server 
Exiting 
/home/alex/.rubies/ruby-2.3.1/lib/ruby/2.3.0/psych.rb:377:in `parse': (<unknown>): did not find expected key while parsing a block mapping at line 8 column 7 (Psych::SyntaxError) 
     from /home/alex/.rubies/ruby-2.3.1/lib/ruby/2.3.0/psych.rb:377:in `parse_stream' 
     from /home/alex/.gem/ruby/2.3.1/gems/mongoid-4.0.2/lib/mongoid/config/environment.rb:40:in `load_yaml' 
     from /home/alex/.gem/ruby/2.3.1/gems/mongoid-4.0.2/lib/mongoid/config.rb:83:in `load!' 
     # ............skipped 
     from /home/alex/.gem/ruby/2.3.1/gems/railties-4.1.1/lib/rails/initializable.rb:55:in `block in run_initializers' 
     from /home/alex/.rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each' 
     from /home/alex/.rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component' 
     from /home/alex/.rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from' 
     from /home/alex/.rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component' 
     # .......... skipped 
     from /home/alex/.gem/ruby/2.3.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency' 
     from /home/alex/.gem/ruby/2.3.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require' 
     from /home/alex/projects/ruby/my_project_123/config.ru:3:in `block in <main>' 
     from /home/alex/.gem/ruby/2.3.1/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval' 
     # ............skipped 
     from /home/alex/.gem/ruby/2.3.1/gems/railties-4.1.1/lib/rails/commands.rb:17:in `<top (required)>' 
     from bin/rails:4:in `require' 
     from bin/rails:4:in `<main>' 

この例外を引き起こす可能性がありますか?

答えて

2

PsychはYAMLパーサとエミッタです。このエラーは、ymlファイルのどこかに、キー値の前に余分なスペース(または十分なスペースがない)があることを示します。正しい構文についてはすべてのymlファイル(例:mongoid.yml)を確認してください。 ymlファイルHereを検証できます。以下YAMLで例えば

key_one: 
    inner: 
    - value1 
    - value2 

key_two: 
    inner: 
    - value1 
    - value2 

行7列5は、キー値の前に余分なスペースを有している

関連する問題