WEBRick没有启动,抛出了无效的参数错误

时间:2014-09-27 19:41:03

标签: ruby-on-rails ruby ruby-on-rails-3 gem

我正在尝试为我的本地开发启动WEBRick而没有任何成功。以下是我收到的错误消息。有关它可能失败的原因的任何见解?

由于

C:\Sites\ThinkBlog\crumblr>rails s
=> Booting WEBrick
=> Rails 4.1.4 application starting in development
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces .
=> Ctrl-C to shutdown server
Exiting
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:297:in `initialize': Invalid argume`enter code here`nt - ${::Rails.root}/config/facebook.yml (Errno::EINVAL)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:297:in `open'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:297:in `load_file'
from C:/Sites/ThinkBlog/crumblr/config/initializers/abook.rb:1:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `load'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `block in load'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in `load_dependency'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `load'

1 个答案:

答案 0 :(得分:0)

您错误地插入了字符串,插值以井号(#)开头,而非美元。

您需要将此字符串更改为:

 FACEBOOK_CONFIG = YAML.load_file("#{::Rails.root}/config/facebook.yml")[::Rails.env] 

或者在没有插值的情况下这样做:

sth = YAML.load_file(Rails.root.join 'config', 'facebook.yml')