2009-08-02 48 views
-3

我在應用程序目錄中執行rake操作時出現此錯誤,看起來像YAML加載失敗。 任何人都可以幫忙嗎? 感謝Ruby中的Yaml加載錯誤

C:\Development\RUBY\laibe\ilr>rake --trace 
(in C:/Development/RUBY/laibe/ilr) 
** Invoke default (first_time) 
** Invoke spec (first_time) 
** Invoke db:test:prepare (first_time) 
** Invoke db:abort_if_pending_migrations (first_time) 
** Invoke environment (first_time) 
** Execute environment 
rake aborted! 
syntax error on line 26, col -1: `' 
C:/Ruby/lib/ruby/1.8/yaml.rb:133:in `load' 
C:/Ruby/lib/ruby/1.8/yaml.rb:133:in `load' 
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:880:in `database_configuration' 
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:416:in `initialize_database' 
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:141:in `process' 
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in `send' 
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in `run' 
C:/Development/RUBY/laibe/ilr/config/environment.rb:12 
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' 
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `requi 
+0

你可以包含你的database.yml文件嗎? – 2009-08-02 13:29:01

回答

3

如果你想要一個答案,你必須提供相關信息。錯誤消息非常清楚地說明了什麼是錯誤的:database.yml的第26行有錯誤。但既然你還沒有告訴我們,實際上哪一行是,有沒有辦法回答你的問題。

+0

這是由database.yml引起的問題,謝謝。 – 2009-08-04 08:29:48

0

貌似在config文件夾database.yml被搞砸了。

線880試圖加載該文件:

YAML::load(ERB.new(IO.read(database_configuration_file)).result 

# elsewhere 
def default_database_configuration_file 
    File.join(root_path, 'config', 'database.yml') 
end