Search code examples
ruby-on-railsrails-consoleappfog

how to fix /.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 17, col 9: ` adapter: mysql2' (ArgumentError)


I'm trying to run the rails console on Appfog by following this document. I set up my database.yml as described, but when I run RAILS_ENV=proxied-appfog rails console I'm getting this error:

/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 22, col 9: `    adapter: mysql2' (ArgumentError)
    from /.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/yaml.rb:133:in `load'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/railties-3.2.13/lib/rails/application/configuration.rb:115:in `database_configuration'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/activerecord-3.2.13/lib/active_record/railtie.rb:78
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:26:in `on_load'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:25:in `each'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:25:in `on_load'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/activerecord-3.2.13/lib/active_record/railtie.rb:74
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `run_initializers'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `send'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /development/baking_journal/config/environment.rb:5
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/railties-3.2.13/lib/rails/application.rb:103:in `require_environment!'
    from /.rvm/gems/ruby-1.8.7-p352@journal/gems/railties-3.2.13/lib/rails/commands.rb:40
    from script/rails:6:in `require'
    from script/rails:6

First of all I don't want to touch anything in rvm... but I did open that file to see what the problem was since it gave me a line number. That line contains no code. So I'm beyond confused. Whats the problem here? The only thing I can imagine is that maybe it doesn't support my version of ruby? but if you type in af runtimes the list returned is:

+---------+-------------+---------+
| Name    | Description | Version |
+---------+-------------+---------+
| python2 |             | 2.7.3   |
| node08  |             | 0.8.14  |
| php     |             | 5.3.10  |
| java    |             | 1.7.0   |
| ruby18  |             | 1.8.7   |
| ruby192 |             | 1.9.2   |
| ruby193 |             | 1.9.3   |
| node04  |             | 0.4.12  |
| node06  |             | 0.6.17  |
+---------+-------------+---------+

Any ideas?

Also, if I try to af update with the new database.yml and proxied-appfog.rb environment file, I'm not able to start the server anymore. So this error is given to me before I push my changes to the server.


Solution

  • Can you post your database.yml file verbatim? You probably have a syntax error in it, whitespace-related. YAML is whitespace-sensitive.

    Double check your YML file for errant spaces. Indent sub-levels with two spaces rather than tabs.