2011-08-10 11 views
6

¿Por qué recibo el siguiente error cuando ejecuto rails console?Error de sintaxis de rieles en el archivo YAML?

NOTE: Gem.available? is deprecated, use Specification::find_by_name. It will be removed on or after 2011-11-01. 
Gem.available? called from /Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/jasmine-1.0.2.1/lib/jasmine/base.rb:64. 
syntax error on line 1, col 1: `:' 
/Users/Chetan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/syck.rb:135:in `load' 
/Users/Chetan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/syck.rb:135:in `load' 
/Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/newrelic_rpm-3.1.1/lib/new_relic/control/instance_methods.rb:151:in `initialize' 
/Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/newrelic_rpm-3.1.1/lib/new_relic/control/class_methods.rb:21:in `new' 
/Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/newrelic_rpm-3.1.1/lib/new_relic/control/class_methods.rb:21:in `new_instance' 
/Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/newrelic_rpm-3.1.1/lib/new_relic/control/class_methods.rb:8:in `instance' 
/Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/newrelic_rpm-3.1.1/lib/newrelic_rpm.rb:36:in `block in <class:Railtie>' 
/Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc5/lib/rails/initializable.rb:25:in `instance_exec' 
/Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc5/lib/rails/initializable.rb:25:in `run' 
/Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc5/lib/rails/initializable.rb:50:in `block in run_initializers' 
/Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc5/lib/rails/initializable.rb:49:in `each' 
/Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc5/lib/rails/initializable.rb:49:in `run_initializers' 
/Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc5/lib/rails/application.rb:92:in `initialize!' 
/Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc5/lib/rails/railtie/configurable.rb:30:in `method_missing' 
/Users/Chetan/Development/othermind/config/environment.rb:5:in `<top (required)>' 
/Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc5/lib/active_support/dependencies.rb:237:in `require' 
/Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc5/lib/active_support/dependencies.rb:237:in `block in require' 
/Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc5/lib/active_support/dependencies.rb:223:in `block in load_dependency' 
/Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc5/lib/active_support/dependencies.rb:639:in `new_constants_in' 
/Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc5/lib/active_support/dependencies.rb:223:in `load_dependency' 
/Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc5/lib/active_support/dependencies.rb:237:in `require' 
/Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc5/lib/rails/application.rb:78:in `require_environment!' 
/Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc5/lib/rails/commands.rb:39:in `<top (required)>' 
script/rails:6:in `require' 
script/rails:6:in `<main>' 
/Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/newrelic_rpm-3.1.1/lib/new_relic/control/instance_methods.rb:156:in `rescue in initialize': Error reading newrelic.yml file: syntax error on line 1, col 1: `:' (RuntimeError) 
    from /Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/newrelic_rpm-3.1.1/lib/new_relic/control/instance_methods.rb:139:in `initialize' 
    from /Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/newrelic_rpm-3.1.1/lib/new_relic/control/class_methods.rb:21:in `new' 
    from /Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/newrelic_rpm-3.1.1/lib/new_relic/control/class_methods.rb:21:in `new_instance' 
    from /Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/newrelic_rpm-3.1.1/lib/new_relic/control/class_methods.rb:8:in `instance' 
    from /Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/newrelic_rpm-3.1.1/lib/newrelic_rpm.rb:36:in `block in <class:Railtie>' 
    from /Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc5/lib/rails/initializable.rb:25:in `instance_exec' 
    from /Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc5/lib/rails/initializable.rb:25:in `run' 
    from /Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc5/lib/rails/initializable.rb:50:in `block in run_initializers' 
    from /Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc5/lib/rails/initializable.rb:49:in `each' 
    from /Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc5/lib/rails/initializable.rb:49:in `run_initializers' 
    from /Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc5/lib/rails/application.rb:92:in `initialize!' 
    from /Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc5/lib/rails/railtie/configurable.rb:30:in `method_missing' 
    from /Users/Chetan/Development/othermind/config/environment.rb:5:in `<top (required)>' 
    from /Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc5/lib/active_support/dependencies.rb:237:in `require' 
    from /Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc5/lib/active_support/dependencies.rb:237:in `block in require' 
    from /Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc5/lib/active_support/dependencies.rb:223:in `block in load_dependency' 
    from /Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc5/lib/active_support/dependencies.rb:639:in `new_constants_in' 
    from /Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc5/lib/active_support/dependencies.rb:223:in `load_dependency' 
    from /Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc5/lib/active_support/dependencies.rb:237:in `require' 
    from /Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc5/lib/rails/application.rb:78:in `require_environment!' 
    from /Users/Chetan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc5/lib/rails/commands.rb:39:in `<top (required)>' 
    from script/rails:6:in `require' 
    from script/rails:6:in `<main>' 

El archivo newrelic.yml en cuestión (de la sección de Cedro de this guide):

--- 
<%= ENV["RAILS_ENV"] %>: 
    error_collector: 
    capture_source: true 
    enabled: true 
    ignore_errors: ActionController::RoutingError 
    apdex_t: 0.5 
    ssl: false 
    monitor_mode: true 
    license_key: <%= ENV["NEW_RELIC_LICENSE_KEY"] %> 
    developer_mode: false 
    app_name: <%= ENV["NEW_RELIC_APPNAME"] %> 
    transaction_tracer: 
    record_sql: obfuscated 
    enabled: true 
    stack_trace_threshold: 0.5 
    transaction_threshold: apdex_f 
    capture_params: false 
    log_level: info 

Analiza bien con http://yaml-online-parser.appspot.com/ ...

Respuesta

12

Su mensaje de error indica que <%= ENV["RAILS_ENV"] %> viene con las manos vacías entonces la primera línea de su YAML es solo un punto y eso no es muy útil.

supongo que está utilizando los carriles 3 y ENV['RAILS_ENV'] ya no está disponible (nota: Yo sé que no es de alrededor de 3.1 pero no estoy seguro de aproximadamente 3,0). Trate de usar esto:

<%= Rails.env %>: 

lugar, Rails.env debería estar disponible en todas las versiones rieles que es muy probable que esté utilizando. Y si eso no funciona, puede intentar ir directamente a:

production: 

ya que es probable que haya su entorno Heroku de todos modos.

+0

'Rails.env' funcionó. ¡Gracias! – Chetan

Cuestiones relacionadas