AndyAdamantium
AndyAdamantium

Reputation: 103

Using rake in ruby/rails and getting an error parsing the YAML

I'm new to Ruby / Rails and an working on a project to design a webpage that uses a mysql database within the framework. I've had a lot of issues getting rails to work properly, but I'm fairly sure one problem is with Rake. When I run the command

    rake db:create:all

it returns around 300 lines, then the ruby interpreter crashes.

My main concern is that when I run the command

    rake -v

I get

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

The YAML thing is just a smaller part of a bigger problem. I'm just not sure why rake isn't working at all.

Edit: Heres the trace.

    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>'

Upvotes: 0

Views: 891

Answers (1)

Agung Prasetyo
Agung Prasetyo

Reputation: 4483

what about add following snippet code at boot.rb after require 'rubygems', i think it happen because yaml parser that use by rubygems is psych but rails need syck :

require 'yaml'
YAML::ENGINE.yamler = 'syck'

Upvotes: 4

Related Questions