我在笔记本电脑上运行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>'
8条答案
按热度按时间c86crjj01#
YAML不接受TAB字符(
\t
)作为缩进。请在config/application.yml
中查找这些字符并替换为2个空格。(* 或者可能有其他语法错误,如Ryan所建议的。但我打赌这一个 *)
3ks5zfa02#
这个错误来自于Figaro gem,这表示您可能在
config/application.yml
中有语法错误。请仔细检查这个档案是否有任何不正确的YAML语法。isr3a4wc3#
可能不是你的具体例子,但堆栈溢出的标题导致我在这篇文章,所以对于那些工作与此错误,它可能是由于:
一个翻译的yml或任何yaml...
字符串插值前后没有双引号
更正:
rsaldnfx4#
我也有同样的问题。我肯定是制表符(\t)的问题。请用2个空格替换。
hgqdbh6s5#
你应该检查所有包含YAML的重要配置文件。我在尝试
rake db:seed
时也遇到了同样的错误,结果发现我在config/database.yml
的注解块中有TAB字符。如果您不确定,请使用一些在线YAML解析器,例如http://yaml-online-parser.appspot.com/。
9avjhtql6#
当其中一个yaml文件获得语法错误“* yaml中没有选项卡 *"时会发生此错误,yaml文件可能是
database.yaml
,application.yaml
等。wwtsj6pe7#
当你在yaml中使用未声明的变量时,也会发生这个问题,这会导致缩进问题。在我的例子中,类似于:
因此,请确保声明了所有变量。
okxuctiv8#
[
](第一次)
发展:设备数据库密码:“qaz”分段:STAG数据库密码:'卡兹'
每下一行中不应有任何空格