简体   繁体   English

Psych :: SyntaxError无法解析YAML

[英]Psych::SyntaxError couldn't parse YAML

I am facing problem in rails application running on fedora 16 Rails version 2.3.5 and Ruby 1.9.2.p320 . 我在fedora 16 Rails版本2.3.5和Ruby 1.9.2.p320上运行的Rails应用程序中遇到问题。 The application running fine on Ubuntu 11.10. 该应用程序在Ubuntu 11.10上运行良好。 When I run the rails server and Hit any controller the following error in coming. 当我运行rails服务器并点击任何控制器时,出现以下错误。

Psych::SyntaxError in controllername#actionname Psych :: SyntaxError在controllername#actionname中

couldn't parse YAML 无法解析YAML

I have tried the apply the following trick but it's not work for me. 我尝试了以下技巧,但是对我来说不起作用。

I have added the following line in config/boot.rb 我在config / boot.rb中添加了以下行

require 'yaml'

YAML::ENGINE.yamler = 'syck'

the error trace is 错误跟踪是

.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/ruby-1.9.2-p320@sunago/gems/activesupport-2.3.5/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:189:in `load_yml'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/activesupport-2.3.5/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:176:in `load_file'
.rvm/gems/ruby-1.9.2-p320@sunago/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/ruby-1.9.2-p320@sunago/gems/activesupport-2.3.5/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:13:in `each'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/activesupport-2.3.5/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:13:in `load_translations'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/activesupport-2.3.5/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:85:in `init_translations'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/activesupport-2.3.5/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:74:in `available_locales'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/activesupport-2.3.5/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb:50:in `available_locales'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_view/template.rb:226:in `valid_locale?'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_view/template.rb:243:in `parse_extensions'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_view/template.rb:233:in `split'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_view/template.rb:118:in `initialize'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_view/reloadable_template.rb:81:in `initialize'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_view/reloadable_template.rb:38:in `new'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_view/reloadable_template.rb:38:in `register_template_from_file'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_view/reloadable_template.rb:62:in `block in load_all_templates_from_dir'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_view/reloadable_template.rb:62:in `each'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_view/reloadable_template.rb:62:in `load_all_templates_from_dir'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_view/reloadable_template.rb:29:in `[]'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_view/paths.rb:48:in `block in find_template'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_view/paths.rb:47:in `each'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_view/paths.rb:47:in `find_template'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_controller/base.rb:1389:in `default_template'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_controller/base.rb:905:in `render'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:51:in `block in render_with_benchmark'
.rvm/gems/ruby-1.9.2-p320@sunago/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/ruby-1.9.2-p320@sunago/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:in `ms'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:51:in `render_with_benchmark'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_controller/base.rb:1326:in `default_render'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_controller/base.rb:1332:in `perform_action'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_controller/filters.rb:617:in `call_filters'
.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_controller/filters.rb:610:in `perform_action_with_filters'
/.rvm/gems/ruby-1.9.2-p320@sunago/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:68:in `block in perform_action_with_benchmark'
.rvm/gems/ruby-1.9.2-p320@sunago/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

Older YAML parsers did not like having tabs but only spaces. 较早的YAML解析器不喜欢使用制表符,而只喜欢使用空格。 You might want to check your YAML file to see if it has any tabs at line 18. If this is the case, you might want to either fix your YAML files or upgrade the parser. 您可能需要检查YAML文件,以查看其在第18行是否具有任何选项卡。如果是这种情况,则可能要修复YAML文件或升级解析器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM