2012-05-04 13 views
10

私はfedora 16 Railsバージョン2.3.5とRuby 1.9.2.p320で動作するレールアプリケーションに問題があります。アプリケーションはUbuntu 11.10上で正常に動作しています。私は、レールサーバーを実行し、次のエラーが来る任意のコントローラを押してください。 controllernameの番号のactionNameの中Psych :: SyntaxErrorがYAMLを解析できません

サイコ::にSyntaxErrorは

は、私は、次のトリックを適用しようとしたが、それは私のために動作していないYAML

を解析できませんでした。

私は設定/ boot.rbに

require 'yaml' 

YAML::ENGINE.yamler = 'syck' 

を次の行を追加したエラートレースは

.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/psych.rb:148:in `parse' 
.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/psych.rb:148:in `parse_stream' 
.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/psych.rb:119:in `parse' 
.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/psych.rb:106:in `load' 
.rvm/gems/[email protected]/gems/activesupport-2.3.5/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:189:in `load_yml' 
.rvm/gems/[email protected]/gems/activesupport-2.3.5/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:176:in `load_file' 
.rvm/gems/[email protected]/gems/activesupport-.3.5/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:13:in `block in load_translations' 
.rvm/gems/[email protected]/gems/activesupport-2.3.5/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:13:in `each' 
.rvm/gems/[email protected]/gems/activesupport-2.3.5/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:13:in `load_translations' 
.rvm/gems/[email protected]/gems/activesupport-2.3.5/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:85:in `init_translations' 
.rvm/gems/[email protected]/gems/activesupport-2.3.5/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:74:in `available_locales' 
.rvm/gems/[email protected]/gems/activesupport-2.3.5/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb:50:in `available_locales' 
.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_view/template.rb:226:in `valid_locale?' 
.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_view/template.rb:243:in `parse_extensions' 
.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_view/template.rb:233:in `split' 
.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_view/template.rb:118:in `initialize' 
.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_view/reloadable_template.rb:81:in `initialize' 
.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_view/reloadable_template.rb:38:in `new' 
.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_view/reloadable_template.rb:38:in `register_template_from_file' 
.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_view/reloadable_template.rb:62:in `block in load_all_templates_from_dir' 
.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_view/reloadable_template.rb:62:in `each' 
.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_view/reloadable_template.rb:62:in `load_all_templates_from_dir' 
.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_view/reloadable_template.rb:29:in `[]' 
.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_view/paths.rb:48:in `block in find_template' 
.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_view/paths.rb:47:in `each' 
.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_view/paths.rb:47:in `find_template' 
.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_controller/base.rb:1389:in `default_template' 
.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_controller/base.rb:905:in `render' 
.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:51:in `block in render_with_benchmark' 
.rvm/gems/[email protected]/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:in `block in ms' 
.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/benchmark.rb:310:in `realtime' 
.rvm/gems/[email protected]/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:in `ms' 
.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:51:in `render_with_benchmark' 
.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_controller/base.rb:1326:in `default_render' 
.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_controller/base.rb:1332:in `perform_action' 
.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_controller/filters.rb:617:in `call_filters' 
.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_controller/filters.rb:610:in `perform_action_with_filters' 
/.rvm/gems/[email protected]/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:68:in `block in perform_action_with_benchmark' 
.rvm/gems/[email protected]/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:in `block in ms' 
.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/benchmark.rb:310:in `realtime 

答えて

7

古いYAMLパーサはタブだけのスペースを持っ好きではなかったです。 YAMLファイルを調べて、18行目にタブがあるかどうか確認したい場合は、YAMLファイルを修正するか、パーサーをアップグレードすることができます。あなたが一日保存 -

+2

私はenvironment.rbにファイルに次の行を追加した は 'YAML' YAML :: ENGINE.yamler = 'はSyck' –

+0

感謝を必要としています。 – johndpope

+0

それは正しい解決策でした。別の行に "YAML :: ENGINE.yamler = 'syck'"を付けるようにしてください。 –

関連する問題