Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails: NameError: uninitialized constant Rails::Application::YAML

I was trying to deploy my application to heroku and got this error. I've been googling around and haven't see anyone with a YAML issue so thought I ask online. Any help would be greatly appreciated

 remote: -----> Preparing app for Rails asset pipeline
 remote:        Running: rake assets:precompile
 remote:        rake aborted!
 remote:        NameError: uninitialized constant Rails::Application::YAML
 remote:        /tmp/build_78ce680a858c094f796e2b21b5bb1826/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/application.rb:377:in `secrets'
 remote:        /tmp/build_78ce680a858c094f796e2b21b5bb1826/config/environments/production.rb:2:in `block in <top (required)>'
 remote:        /tmp/build_78ce680a858c094f796e2b21b5bb1826/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/railtie.rb:210:in `instance_eval'
 remote:        /tmp/build_78ce680a858c094f796e2b21b5bb1826/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/railtie.rb:210:in `configure'
 remote:        /tmp/build_78ce680a858c094f796e2b21b5bb1826/config/environments/production.rb:1:in `<top (required)>'
 remote:        /tmp/build_78ce680a858c094f796e2b21b5bb1826/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/engine.rb:598:in `block (2 levels) in <class:Engine>'
 remote:        /tmp/build_78ce680a858c094f796e2b21b5bb1826/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/engine.rb:597:in `each'
 remote:        /tmp/build_78ce680a858c094f796e2b21b5bb1826/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/engine.rb:597:in `block in <class:Engine>'
 remote:        /tmp/build_78ce680a858c094f796e2b21b5bb1826/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `instance_exec'
 remote:        /tmp/build_78ce680a858c094f796e2b21b5bb1826/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `run'
 remote:        /tmp/build_78ce680a858c094f796e2b21b5bb1826/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/initializable.rb:55:in `block in run_initializers'
 remote:        /tmp/build_78ce680a858c094f796e2b21b5bb1826/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/initializable.rb:44:in `each'
 remote:        /tmp/build_78ce680a858c094f796e2b21b5bb1826/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/initializable.rb:44:in `tsort_each_child'
 remote:        /tmp/build_78ce680a858c094f796e2b21b5bb1826/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/initializable.rb:54:in `run_initializers'
 remote:        /tmp/build_78ce680a858c094f796e2b21b5bb1826/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/application.rb:352:in `initialize!'
 remote:        /tmp/build_78ce680a858c094f796e2b21b5bb1826/config/environment.rb:5:in `<top (required)>'
 remote:        /tmp/build_78ce680a858c094f796e2b21b5bb1826/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/application.rb:328:in `require'
 remote:        /tmp/build_78ce680a858c094f796e2b21b5bb1826/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/application.rb:328:in `require_environment!'
 remote:        /tmp/build_78ce680a858c094f796e2b21b5bb1826/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/application.rb:443:in `block in run_tasks_blocks'
 remote:        /tmp/build_78ce680a858c094f796e2b21b5bb1826/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.3.1/lib/sprockets/rails/task.rb:64:in `block (2 levels) in define'
 remote:        Tasks: TOP => environment
 remote:        (See full trace by running task with --trace)

Checking out my heroku logs

 2015-06-07T00:58:16.085579+00:00 heroku[slug-compiler]: Slug compilation started
 2015-06-07T00:58:16.085600+00:00 heroku[slug-compiler]: Slug compilation failed: failed to compile Ruby app
like image 824
kkomaz Avatar asked Feb 09 '23 22:02

kkomaz


2 Answers

I am not quite sure what happened but I did a

require 'yaml'

in my production.rb file and it worked. I do not know why it is working but will update if I find out.

like image 193
kkomaz Avatar answered Mar 08 '23 09:03

kkomaz


There is a bug in some versions of rails ( 4.2.1 and 4.2.2 that I know of) There is a missing require 'yaml' statement in the file in the first line of the error message. On a VPS you can insert it yourself, but I am not sure how to do it with Heroku. When I raised it on GitHub I was advised to upgrade to the next rails version...

like image 31
GoodViber Avatar answered Mar 08 '23 07:03

GoodViber