Reputation: 836
I am working on Rails 2.3.2 application with Ruby version of 1.9.3p551 (on RVM). When I am trying to run this old application, I am getting an 'Psych Syntax Error' that is when I run rake db:migrate or rake -v or any other, I am getting error. Please help me. The error log I got is:
myuser@iam:~/Desktop/practice/Application$ rake -v
rake aborted!
Psych::SyntaxError: (<unknown>): did not find expected node content while parsing a flow node at line 18 column 14
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:189:in `load_yml'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:176:in `load_file'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:13:in `block in load_translations'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:13:in `each'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:13:in `load_translations'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:85:in `init_translations'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:74:in `available_locales'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb:50:in `available_locales'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_view/template.rb:215:in `valid_locale?'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_view/template.rb:234:in `split'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_view/template.rb:113:in `initialize'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_view/template.rb:87:in `new'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_view/template.rb:87:in `create_template'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_view/template.rb:82:in `block in templates_in_path'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_view/template.rb:81:in `each'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_view/template.rb:81:in `templates_in_path'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_view/template.rb:64:in `load!'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_view/template.rb:49:in `block in new_and_loaded'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/core_ext/object/misc.rb:39:in `returning'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_view/template.rb:48:in `new_and_loaded'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_controller/rescue.rb:41:in `<module:Rescue>'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_controller/rescue.rb:17:in `<module:ActionController>'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_controller/rescue.rb:1:in `<top (required)>'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_controller/base.rb:1406:in `block in <module:ActionController>'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_controller/base.rb:1405:in `class_eval'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_controller/base.rb:1405:in `<module:ActionController>'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_controller/base.rb:3:in `<top (required)>'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/rails-2.3.2/lib/initializer.rb:446:in `initialize_framework_caches'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/rails-2.3.2/lib/initializer.rb:144:in `process'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/rails-2.3.2/lib/initializer.rb:113:in `run'
/home/myuser/Desktop/practice/Application/config/environment.rb:9:in `<top (required)>'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `block in require'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/rails-2.3.2/lib/tasks/misc.rake:4:in `block in <top (required)>'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/rails-2.3.2/lib/tasks/testing.rake:45:in `block (2 levels) in <top (required)>'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/rails-2.3.2/lib/tasks/testing.rake:43:in `collect'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/rails-2.3.2/lib/tasks/testing.rake:43:in `block in <top (required)>'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/bin/ruby_executable_hooks:15:in `eval'
/home/myuser/.rvm/gems/ruby-1.9.3-p551/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => test:units => db:test:prepare => db:abort_if_pending_migrations => environment
(See full trace by running task with --trace)
Upvotes: 0
Views: 602
Reputation: 102134
It looks like a syntax error in one of the localization files which are located inside config/locales
. The trace does not name the file - you can try running the task with the --trace
or you can try parsing each of the files:
require 'yaml'
Dir.glob("config/locales/*.yml").each do |f|
begin
YAML.load(File.read(f))
rescue Psych::SyntaxError => e
puts "YAML syntax error in: #{f}"
puts e.message
end
end
You can either place this in a file in your rails root directry and run it with ruby locale_linter.rb
or by copy pasting this into the normal irb
console.
The output should point you to the offending file:
Syntax error in: config/locales/en.yml
(<unknown>): did not find expected key while parsing a block mapping at line 23 column 3
=> ["config/locales/en.yml"]
Upvotes: 1