我在主页上收到的错误是:
We're sorry, but something went wrong.
我在日志文件(log / production.log)中收到的错误:
ActionView::Template::Error (application.css isn't precompiled):
2: <html>
3: <head>
4: <title>Reach</title>
5: <%= stylesheet_link_tag "application", media: "all" %>
6: <%= requirejs_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: </head>
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___2601724748379559821_29475380'
我看过这个:
rails 3.1.0 ActionView::Template::Error (application.css isn't precompiled)
bundle exec rake assets:precompile
在控制台中显示:
/usr/local/rvm/rubies/ruby-1.9.3-p429/bin/ruby /usr/local/rvm/gems/ruby-1.9.3-p429/bin/rake requirejs:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
/usr/local/rvm/rubies/ruby-1.9.3-p429/bin/ruby /usr/local/rvm/gems/ruby-1.9.3-p429/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
我收到同样的错误
有什么建议吗?
更新
我追踪了预编译,这是结果:
** Invoke assets:precompile (first_time)
** Invoke requirejs:precompile:external (first_time)
** Invoke requirejs:test_node (first_time)
** Execute requirejs:test_node
** Execute requirejs:precompile:external
/usr/local/rvm/rubies/ruby-1.9.3-p429/bin/ruby /usr/local/rvm/gems/ruby-1.9.3-p429/bin/rake requirejs:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke requirejs:precompile:all (first_time)
** Invoke requirejs:precompile:prepare_source (first_time)
** Invoke requirejs:setup (first_time)
** Invoke assets:environment (first_time)
** Invoke requirejs:precompile:disable_js_compressor (first_time)
** Execute requirejs:precompile:disable_js_compressor
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute requirejs:setup
** Invoke requirejs:clean (first_time)
** Invoke requirejs:setup
** Execute requirejs:clean
** Execute requirejs:precompile:prepare_source
** Invoke requirejs:precompile:generate_rjs_driver (first_time)
** Invoke requirejs:setup
** Execute requirejs:precompile:generate_rjs_driver
** Invoke requirejs:precompile:run_rjs (first_time)
** Invoke requirejs:setup
** Invoke requirejs:test_node (first_time)
** Execute requirejs:test_node
** Execute requirejs:precompile:run_rjs
** Invoke requirejs:precompile:digestify_and_compress (first_time)
** Invoke requirejs:setup
** Execute requirejs:precompile:digestify_and_compress
** Execute requirejs:precompile:all
** Execute assets:precompile
/usr/local/rvm/rubies/ruby-1.9.3-p429/bin/ruby /usr/local/rvm/gems/ruby-1.9.3-p429/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
一切正常,我需要touch tmp/restart.txt
在预编译后重启Rails。
答案 0 :(得分:1)
尝试RAILS_ENV=production bundle exec rake assets:precompile
http://guides.rubyonrails.org/asset_pipeline.html#precompiling-assets
答案 1 :(得分:0)
好的,我意识到我上面没有提到,但我是RoR的新手。我在这里添加这个,以防任何人遇到我所犯的同样容易的错误。
我不得不
touch tmp/restart.txt
预编译后。