Denis Davydov
Denis Davydov

Reputation: 462

Ruby on Rails in production error

I've just put my Rails app online in production. And I kind of have two problems:

  1. I get a 500 on my website for which the production.log says:

    Completed 500 Internal Server Error in 10.0ms ActionView::Template::Error (./icons/icon_nameplate.png isn't precompiled):

    For this what I tried is running the following command:

    bundle exec rake assets:precompile

    This didn't work. I want to say that when I run the server locally on my computer with rails server everything works just fine.

    Output of bundle exec rake assets:clean assets:precompile --trace:

    ** Invoke assets:clean (first_time) ** Execute assets:clean /usr/bin/ruby1.9.1 /usr/local/bin/rake assets:clean:all RAILS_ENV=production RAILS_GROUPS=assets --trace ** Invoke assets:clean:all (first_time) ** Invoke assets:environment (first_time) ** Execute assets:environment ** Invoke environment (first_time) ** Execute environment ** Invoke tmp:cache:clear (first_time) ** Execute tmp:cache:clear ** Execute assets:clean:all rm -rf /home/celliptic/public/assets ** Invoke assets:precompile (first_time) ** Execute assets:precompile /usr/bin/ruby1.9.1 /usr/local/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace ** Invoke assets:precompile:all (first_time) ** Execute assets:precompile:all ** Invoke assets:precompile:primary (first_time) ** Invoke assets:environment (first_time) ** Execute assets:environment ** Invoke environment (first_time) ** Execute environment ** Invoke tmp:cache:clear (first_time) ** Execute tmp:cache:clear ** Execute assets:precompile:primary ** Invoke assets:precompile:nondigest (first_time) ** Invoke assets:environment (first_time) ** Execute assets:environment ** Invoke environment (first_time) ** Execute environment ** Invoke tmp:cache:clear (first_time) ** Execute tmp:cache:clear ** Execute assets:precompile:nondigest

  2. The second problem may be why the first one didn't get corrected after precompilation. It's just that any modification on the server isn't directly reflected on the website. Is it normal? Is it because of some kind of proxy caching my website?

Thank you for your answers!

Upvotes: 0

Views: 164

Answers (4)

Denis Davydov
Denis Davydov

Reputation: 462

Thanks everyone for your help. It works well now, but I don't really know which command made the deal. I've made:

  1. bundle exec rake assets:clean assets:precompile --trace
  2. touch tmp/restart.txt
  3. Changed config.assets.compile = true in production.rb
  4. At this moment it didn't work, so I went to sleep. Woke up, load my website and it worked

So maybe it needed time to activate the changes or I don't know.

Still thank you for your help.

Upvotes: 0

matanco
matanco

Reputation: 2129

Hi what webserver you are using? and under which Linux?

try those steps:

  1. see if you got the permissions to write the compiled assets.

  2. you sure you include it under application.css?

  3. paste your complete css file maybe you use methods like asset-url which can cause the error you talk about.

Upvotes: 0

Richard Peck
Richard Peck

Reputation: 76774

The error you have: ActionView::Template::Error (./icons/icon_nameplate.png isn't precompiled), to me, seems like you're trying to load a static asset when it's not there.

I would look at your views or CSS to where you referenced icon_nameplate.png - I believe the problem will likely be that you're trying to reference the file directly, and as it has not been compiled, it's unavailable. The proof of this would be that it's referencing a static (non fingerprinted) link

After you've followed tungsten_carbide's directions, please let us know what happens

Upvotes: 1

tungsten_carbide
tungsten_carbide

Reputation: 555

Try running:

bundle exec rake assets:clean assets:precompile --trace

then spawn it if you are using passenger:

touch tmp/restart.txt    

then check again.

Upvotes: 1

Related Questions