Psych.load doesn't work on Heroku #55

Closed
ncri opened this Issue Mar 29, 2012 · 12 comments

Comments

2 participants

ncri commented Mar 29, 2012

In my Rails 3.2.2 app

Psych.load('--- foo')  

works fine in my local (production) console. But in on Heroku (cedar stack, ruby 1.9.2) I get this error:

irb(main):001:0> Psych.load('--- foo') 
LoadError: no such file to load -- --- foo
    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:245:in `load'
    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:245:in `block in load'
    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:245:in `load'
    from (irb):1
    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/commands/console.rb:47:in `start'
    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/commands/console.rb:8:in `start'
    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
Owner

tenderlove commented Mar 29, 2012

What version of Ruby are you running on your local machine?

ncri commented Mar 29, 2012

ruby-1.9.2-p290-railsexpress [ x86_64 ], a patched ruby installed via rvm

ncri commented Mar 29, 2012

Oh, and I don't have the psych gem installed. Ruby 1.9.2 comes with Psych, right? Or where is it coming from otherwise?

ncri commented Mar 29, 2012

With ruby-1.9.3-p0 it works too (without the gem installed).

Owner

tenderlove commented Mar 29, 2012

Ya, it's in 1.9.2. It seems like somehow you're doing a require on psych in development but not in production. I'm not sure where that might be happening though.

ncri commented Mar 29, 2012

Okay, I was suspecting the localeapp gem as I found the error through that, but it doesn't have require 'psych' anywhere, neither does my rails app...

Owner

tenderlove commented Mar 29, 2012

I'm guessing that some library code (possibly rails?) is doing it in development but not production. Can you try adding a require 'psych' to your application.rb?

ncri commented Mar 29, 2012

See this issue: Locale/localeapp#27

ncri commented Mar 29, 2012

Hm, require 'psych' doesn't work on Heroku, it gives me "LoadError: no such file to load -- psych" locally it works though...

Owner

tenderlove commented Mar 29, 2012

Seems like they don't have it installed for Ruby 1.9.2. I think this should be fixed in localeapp. Checking for the Psych constant isn't the best way to detect if Psych has been loaded or not. I'll comment on that issue with how to fix.

ncri commented Mar 29, 2012

Thanks, I guess we can close this then?

@tenderlove tenderlove closed this Apr 7, 2012

@ghost

ghost commented Jan 25, 2013

I am also getting same error of "LoadError: no such file to load -- psych" on heroku with ruby 1.9.2. Is there any way i can fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment