After updating the gems I've got this:
/home/megas/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:148:in `parse': couldn't parse YAML at line 182 column 9 (Psych::SyntaxError)
from /home/megas/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:148:in `parse_stream'
from /home/megas/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:119:in `parse'
from /home/megas/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:106:in `load'
from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/RedCloth-4.2.3/lib/redcloth/formatters/latex.rb:6:in `<module:LATEX>'
from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/RedCloth-4.2.3/lib/redcloth/formatters/latex.rb:3:in `<top (required)>'
from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/RedCloth-4.2.3/lib/redcloth.rb:21:in `require'
from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/RedCloth-4.2.3/lib/redcloth.rb:21:in `<top (required)>'
from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/RedCloth-4.2.3/lib/case_sensitive_require/RedCloth.rb:6:in `require'
from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/RedCloth-4.2.3/lib/case_sensitive_require/RedCloth.rb:6:in `<top (required)>'
from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `require'
from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `each'
from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `block in require'
from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `each'
from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `require'
from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler.rb:120:in `require'
from /home/megas/Work/railscasts/config/application.rb:10:in `<top (required)>'
from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/commands.rb:28:in `require'
from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/commands.rb:28:in `block in <top (required)>'
from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/commands.rb:27:in `tap'
from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
ruby-1.9.2-p136 rails 3.0.3
Tried to reinstall gem RedCloth, didn't help, system wants to use only 4.2.3 version
Any idea how to fix it? Thanks
You have invalid YAML code somewhere. I mean invalid for Psych (the new ruby YAML parser).
If you cannot (or don't want to) fix your YAML code, try to load the old YAML parser (syck), adding this at the beginning of config/boot.rb
require 'yaml'
YAML::ENGINE.yamler = 'syck'
It's just a 'quick and dirty' fix, I know
My regular Rails 3 App also had this problem, because I was using a localized yaml File for Date/Times.
As you can see in this commit https://github.com/rails/rails/commit/dc94d81 this can be easy "fixed" by placing the array in seperate lines.
- order: [ :year, :month, :day ]
18 + order:
19 + - :year
20 + - :month
21 + - :day
A slight tweak on Paul Raupach's answer which, when run from a directory, finds all *.yml files recursively in all sub-directories and tests the file. I ran it from my Rails root dir.
require 'yaml'
d = Dir["./**/*.yml"]
d.each do |file|
begin
puts "checking : #{file}"
f = YAML.load_file(file)
rescue StandardError
puts "failed to read #{file}: #{$!}"
end
end
The root cause was described on many places and I will summarize it again.
There are two default yaml parser Psych is the new one, the one you should be using. Syck is the old one, its not maintained and dying, its currently used as fall back for when there is no libyaml present (non-linux systems usually).
The important thing is you have some invalid yaml somewhere. It is most probably in your translation files (I had unquoted strings strating with %). Just try loading all your yml files with YAML.load_file on the production box and you will see which one is the broken one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With