0

我是 Ruby/Rails 的新手,并且正在从事一个项目来设计一个在框架内使用 mysql 数据库的网页。我在让rails 正常工作时遇到了很多问题,但我很确定Rake 是一个问题。当我运行命令时

    rake db:create:all

它返回大约 300 行,然后 ruby​​ 解释器崩溃。

我主要担心的是当我运行命令时

    rake -v

我明白了

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

YAML 只是更大问题的一小部分。我只是不确定为什么 rake 根本不起作用。

编辑:继承人的踪迹。

    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

在需要'rubygems'之后在boot.rb中添加以下代码片段怎么样,我认为这是因为rubygems使用的yaml解析器是psych但rails需要syck:

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