我已经在笔记本电脑上运行Ruby on Rails大约一个月了,但是当我想在这个实例中运行服务器时(几小时前工作正常)我现在收到此消息。我怎样才能让服务器再次运行?
C:\Sites\LaunchPage>rails s
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:203:in `parse': (<unknown>):
found character that cannot start any token while scanning for the next token at line 17 column 17 (Psych::SyntaxError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:203:in `parse_stream'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:151:in `parse'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:127:in `load'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/figaro-0.6.3/lib/figaro.rb:21:in `raw'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/figaro-0.6.3/lib/figaro.rb:17:in `env'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/figaro-0.6.3/lib/figaro/railtie.rb:7:in `block in <class:Railtie>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:34:in `call'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:34:in `execute_hook'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:42:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/application.rb:67:in `inherited'
from C:/Sites/LaunchPage/config/application.rb:13:in `<module:LaunchPage>'
from C:/Sites/LaunchPage/config/application.rb:12:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:53:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:53:in `block in <top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:50:in `tap'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
答案 0 :(得分:74)
YAML不接受缩进的TAB字符(\t
)。在config/application.yml
中查找并替换为2个空格。
(或者可能还有其他语法错误,正如Ryan所建议的那样。但我打赌这个)
答案 1 :(得分:18)
此错误源自Figaro gem,这表明您可能在config/application.yml
中出现语法错误。仔细检查此文件是否有任何错误的YAML语法。
答案 2 :(得分:6)
我和你的问题一样。我确定它的TAB字符(\ t)问题。请更换2个空格。
答案 3 :(得分:4)
可能不是您的具体示例,但Stack Overflow的标题导致我出现在此帖子中,因此对于使用此错误的人来说,可能是由于:
en.yml或翻译yml或任何yaml ...
字符串插值周围没有双引号
points:
other: %{points} points
校正:
points:
other: "%{points} points"
答案 4 :(得分:2)
您应该检查包含YAML的所有重要配置文件。尝试rake db:seed
时遇到了同样的错误,结果发现我在config/database.yml
的评论区块中有TAB字符。
如果您不确定,请使用一些在线YAML解析器,即http://yaml-online-parser.appspot.com/。
答案 5 :(得分:1)
当其中一个yaml文件出现语法错误“ yaml中没有选项卡”时,会发生此错误,yaml文件可能为database.yaml
,application.yaml
等。
答案 6 :(得分:-1)
[]
发展: DEV_DB_PASSWORD:“ qaz” 分期: STAG_DB_PASSWORD:“ qaz”
下一行中不应有空格