新手问题 怎么解决 “(<unknown>): found a tab character that violate intendation while scanning a plain scalar at line 5 column 20” 呢?

tinyfool · 2014年06月19日 · 最后由 chuang 回复于 2017年03月09日 · 8562 次阅读

把我的 ROR 代码部署到了 Linux 上去,需要安装的东西都安装好了,执行./bin/rails s,服务器可以启动,访问的时候发现页面报错为:

Internal Server Error

(<unknown>): found a tab character that violate intendation while scanning a plain scalar at line 5 column 20
WEBrick/1.3.1 (Ruby/2.1.2/2014-05-08) at democodes.com:3000

命令行的反馈是:

./bin/rails s
=> Booting WEBrick
=> 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
[2014-06-19 15:55:44] INFO  WEBrick 1.3.1
[2014-06-19 15:55:44] INFO  ruby 2.1.2 (2014-05-08) [i686-linux]
[2014-06-19 15:55:44] INFO  WEBrick::HTTPServer#start: pid=24706 port=3000
[2014-06-19 15:55:47] ERROR Psych::SyntaxError: (<unknown>): found a tab character that violate intendation while scanning a plain scalar at line 5 column 20
    /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/psych.rb:370:in `parse'
    /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/psych.rb:370:in `parse_stream'
    /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/psych.rb:318:in `parse'
    /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/psych.rb:245:in `load'
    /usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application.rb:313:in `secrets'
    /usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application.rb:439:in `validate_secret_key_config!'
    /usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application.rb:195:in `env_config'
    /usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/engine.rb:510:in `call'
    /usr/local/rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application.rb:144:in `call'
    /usr/local/rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
    /usr/local/rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
    /usr/local/rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
    /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
    /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
    /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'

看看是不是 secrets.yml 里面哪里把 tab 当成空格了。要是用 vim 就:/s\t查找。

#1 楼 @billy 谢谢,问题解决

@billy 你好,这个问题如何帮忙看下处理下呢?

bundle exec rails server webrick -e production

=> Booting WEBrick => Rails 4.2.6 application starting in production on http://localhost:3000 => Run rails server -h for more startup options => Ctrl-C to shutdown server Exiting /usr/lib/ruby/2.3.0/psych.rb:377:in parse': (<unknown>): found unexpected end of stream while scanning a quoted scalar at line 249 column 11 (Psych::SyntaxError) from /usr/lib/ruby/2.3.0/psych.rb:377:inparse_stream' from /usr/lib/ruby/2.3.0/psych.rb:325:in parse' from /usr/lib/ruby/2.3.0/psych.rb:252:inload' from /usr/share/redmine/lib/redmine/configuration.rb:86:in load_from_yaml' from /usr/share/redmine/lib/redmine/configuration.rb:42:inload' from /usr/share/redmine/lib/redmine/configuration.rb:67:in []' from /usr/share/redmine/lib/redmine/thumbnail.rb:24:inmodule:Thumbnail' from /usr/share/redmine/lib/redmine/thumbnail.rb:21:in <module:Redmine>' from /usr/share/redmine/lib/redmine/thumbnail.rb:20:in' from /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:274:in require' from /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:274:inblock in require' from /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:240:in load_dependency' from /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:274:inrequire' from /usr/share/redmine/lib/redmine.rb:46:in <top (required)>' from /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:274:inrequire' from /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:274:in block in require' from /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:240:inload_dependency' from /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:274:in require' from /usr/share/redmine/config/initializers/30-redmine.rb:6:in' from /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:268:in load' from /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:268:inblock in load' from /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:240:in load_dependency' from /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:268:inload' from /usr/lib/ruby/vendor_ruby/rails/engine.rb:652:in block in load_config_initializer' from /usr/lib/ruby/vendor_ruby/active_support/notifications.rb:166:ininstrument' from /usr/lib/ruby/vendor_ruby/rails/engine.rb:651:in load_config_initializer' from /usr/lib/ruby/vendor_ruby/rails/engine.rb:616:inblock (2 levels) in class:Engine' from /usr/lib/ruby/vendor_ruby/rails/engine.rb:615:in each' from /usr/lib/ruby/vendor_ruby/rails/engine.rb:615:inblock in class:Engine' from /usr/lib/ruby/vendor_ruby/rails/initializable.rb:30:in instance_exec' from /usr/lib/ruby/vendor_ruby/rails/initializable.rb:30:inrun' from /usr/lib/ruby/vendor_ruby/rails/initializable.rb:55:in block in run_initializers' from /usr/lib/ruby/2.3.0/tsort.rb:228:inblock in tsort_each' from /usr/lib/ruby/2.3.0/tsort.rb:350:in block (2 levels) in each_strongly_connected_component' from /usr/lib/ruby/2.3.0/tsort.rb:422:inblock (2 levels) in each_strongly_connected_component_from' from /usr/lib/ruby/2.3.0/tsort.rb:431:in each_strongly_connected_component_from' from /usr/lib/ruby/2.3.0/tsort.rb:421:inblock in each_strongly_connected_component_from' from /usr/lib/ruby/vendor_ruby/rails/initializable.rb:44:in each' from /usr/lib/ruby/vendor_ruby/rails/initializable.rb:44:intsort_each_child' from /usr/lib/ruby/2.3.0/tsort.rb:415:in call' from /usr/lib/ruby/2.3.0/tsort.rb:415:ineach_strongly_connected_component_from' from /usr/lib/ruby/2.3.0/tsort.rb:349:in block in each_strongly_connected_component' from /usr/lib/ruby/2.3.0/tsort.rb:347:ineach' from /usr/lib/ruby/2.3.0/tsort.rb:347:in call' from /usr/lib/ruby/2.3.0/tsort.rb:347:ineach_strongly_connected_component' from /usr/lib/ruby/2.3.0/tsort.rb:226:in tsort_each' from /usr/lib/ruby/2.3.0/tsort.rb:205:intsort_each' from /usr/lib/ruby/vendor_ruby/rails/initializable.rb:54:in run_initializers' from /usr/lib/ruby/vendor_ruby/rails/application.rb:352:ininitialize!' from /usr/share/redmine/config/environment.rb:14:in <top (required)>' from /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:274:inrequire' from /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:274:in block in require' from /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:240:inload_dependency' from /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:274:in require' from /usr/share/redmine/config.ru:3:inblock in

' from /usr/lib/ruby/vendor_ruby/rack/builder.rb:55:in instance_eval' from /usr/lib/ruby/vendor_ruby/rack/builder.rb:55:ininitialize' from /usr/share/redmine/config.ru:in new' from /usr/share/redmine/config.ru:in' from /usr/lib/ruby/vendor_ruby/rack/builder.rb:49:in eval' from /usr/lib/ruby/vendor_ruby/rack/builder.rb:49:innew_from_string' from /usr/lib/ruby/vendor_ruby/rack/builder.rb:40:in parse_file' from /usr/lib/ruby/vendor_ruby/rack/server.rb:299:inbuild_app_and_options_from_config' from /usr/lib/ruby/vendor_ruby/rack/server.rb:208:in app' from /usr/lib/ruby/vendor_ruby/rails/commands/server.rb:61:inapp' from /usr/lib/ruby/vendor_ruby/rack/server.rb:336:in wrapped_app' from /usr/lib/ruby/vendor_ruby/rack/server.rb:272:instart' from /usr/lib/ruby/vendor_ruby/rails/commands/server.rb:80:in start' from /usr/lib/ruby/vendor_ruby/rails/commands/commands_tasks.rb:80:inblock in server' from /usr/lib/ruby/vendor_ruby/rails/commands/commands_tasks.rb:75:in tap' from /usr/lib/ruby/vendor_ruby/rails/commands/commands_tasks.rb:75:inserver' from /usr/lib/ruby/vendor_ruby/rails/commands/commands_tasks.rb:39:in run_command!' from /usr/lib/ruby/vendor_ruby/rails/commands.rb:17:in' from bin/rails:4:in require' from bin/rails:4:in'

需要 登录 后方可回复, 如果你还没有账号请 注册新账号