0

Ruby / Rails は初めてで、フレームワーク内で mysql データベースを使用する Web ページを設計するプロジェクトに取り組んでいます。Rails を適切に動作させるには多くの問題がありましたが、1 つの問題が Rake にあると確信しています。コマンドを実行すると

    rake db:create:all

約 300 行を返すと、Ruby インタープリターがクラッシュします。

私の主な懸念は、コマンドを実行するときです

    rake -v

私は得る

    ...
    rake aborted!
    (<unknown>) couldn't parse YAML at line 17 column 14

YAML の問題は、大きな問題のほんの一部にすぎません。レーキがまったく機能しない理由がわかりません。

編集:ここにトレースがあります。

    C:\Ruby193\bin\test>rake -v --trace
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:942: Use RbConfig ins
    tead of obsolete and deprecated Config.
    (in C:/Ruby193/bin/test)
    ** Invoke default (first_time)
    ** Invoke test (first_time)
    ** Execute test
    ** Invoke test:units (first_time)
    ** Invoke db:test:prepare (first_time)
    ** Invoke db:abort_if_pending_migrations (first_time)
    ** Invoke environment (first_time)
    ** Execute environment
    ** Execute db:abort_if_pending_migrations
    ** Invoke test:functionals (first_time)
    ** Invoke db:test:prepare
    ** Execute test:functionals
    C:/Ruby193/bin/ruby -Ilib;test "C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/l
    ib/rake/rake_test_loader.rb"
    ** Invoke test:integration (first_time)
    ** Invoke db:test:prepare
    ** Execute test:integration
    C:/Ruby193/bin/ruby -Ilib;test "C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/l
    ib/rake/rake_test_loader.rb"
    rake aborted!
    (<unknown>): couldn't parse YAML at line 17 column 14
    C:/Ruby193/lib/ruby/1.9.1/psych.rb:154:in `parse'
    C:/Ruby193/lib/ruby/1.9.1/psych.rb:154:in `parse_stream'
    C:/Ruby193/lib/ruby/1.9.1/psych.rb:125:in `parse'
    C:/Ruby193/lib/ruby/1.9.1/psych.rb:112:in `load'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/vendo
    r/i18n-0.1.3/lib/i18n/backend/simple.rb:189:in `load_yml'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/vendo
    r/i18n-0.1.3/lib/i18n/backend/simple.rb:176:in `load_file'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/vendo
    r/i18n-0.1.3/lib/i18n/backend/simple.rb:13:in `block in load_translations'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/vendo
    r/i18n-0.1.3/lib/i18n/backend/simple.rb:13:in `each'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/vendo
    r/i18n-0.1.3/lib/i18n/backend/simple.rb:13:in `load_translations'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/vendo
    r/i18n-0.1.3/lib/i18n/backend/simple.rb:85:in `init_translations'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/vendo
    r/i18n-0.1.3/lib/i18n/backend/simple.rb:100:in `lookup'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/vendo
    r/i18n-0.1.3/lib/i18n/backend/simple.rb:33:in `translate'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/vendo
    r/i18n-0.1.3/lib/i18n.rb:165:in `translate'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/core_
    ext/array/conversions.rb:10:in `to_sentence'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.4/lib/tasks/testing.rake:51:in `bl
    ock in <top (required)>'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:617:in `call'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:617:in `block in exec
    ute'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:612:in `each'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:612:in `execute'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:578:in `block in invo
    ke_with_call_chain'
    C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:571:in `invoke_with_c
    all_chain'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:588:in `block in invo
    ke_prerequisites'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:585:in `each'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:585:in `invoke_prereq
    uisites'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:577:in `block in invo
    ke_with_call_chain'
    C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:571:in `invoke_with_c
    all_chain'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:564:in `invoke'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:2019:in `invoke_task'

    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:1997:in `block (2 lev
    els) in top_level'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:1997:in `each'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:1997:in `block in top
    _level'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_exc
    eption_handling'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:1991:in `top_level'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:1970:in `block in run
    '
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_exc
    eption_handling'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:1967:in `run'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.8.3/bin/rake:31:in `<top (required)>'

    C:/Ruby193/bin/rake:23:in `load'
    C:/Ruby193/bin/rake:23:in `<main>'
4

1 に答える 1

4

require 'rubygems' の後に boot.rb に次のスニペット コードを追加するのはどうでしょうか。rubygems で使用される yaml パーサーは psych ですが、Rails には syck が必要なために発生すると思います。

require 'yaml'
YAML::ENGINE.yamler = 'syck'
于 2012-05-07T08:47:36.613 に答える