Reputation: 462
I've just put my Rails app online in production. And I kind of have two problems:
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
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
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:
bundle exec rake assets:clean assets:precompile --trace
touch tmp/restart.txt
config.assets.compile = true
in production.rbSo maybe it needed time to activate the changes or I don't know.
Still thank you for your help.
Upvotes: 0
Reputation: 2129
Hi what webserver you are using? and under which Linux?
try those steps:
see if you got the permissions to write the compiled assets.
you sure you include it under application.css?
paste your complete css file maybe you use methods like asset-url which can cause the error you talk about.
Upvotes: 0
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
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