私はレール・アプリケーションをデプロイしようとしていますが、事前コンパイルエラー。プロダクションログによると、エラーはscreen.cssと呼ばれるBlueprintのCSSスクリプトによって引き起こされています(下のエラー出力で確認できます)。しかし、プロダクションログによれば、この資産は実際にプリコンパイルされています。 blueprintからのアセット・プリコンパイル・エラー - ActionView :: Template :: Error(blueprint/screen.cssがプリコンパイルされていません) - 内部サーバー・エラー500
config.assets.precompile = %w(screen.css print.css)
が、無駄に
を次のように私はapplication.rbおよび設定/環境/ production.rbファイルの両方で、プリコンパイルのアレイにscreen.cssとprint.cssを追加し、明示的にしようとしました。また、私の資産をローカルでプリコンパイルしようとしましたが、すべてをサーバーにプッシュしました。 blueprint css rails 3.1 help と同じ問題がここに未解決のまま: blueprint/screen.css isn't precompiled 、ここで:私はここに概説され、すべての提案を試みた Ruby on Rails 3.2 compiled assets are not working私が何このエラーを解決するために、次しようとする見当がつかない。どんな助けでも大いに感謝します!ログ出力は、私の展開ファイル、capファイル、およびapplication.rbファイルと共に、下にあります。あなたが持っている可能性のある提案について、事前に感謝します!
配備後のログファイルの出力は、screen.cssがプリコンパイルされていることがわかります。エラー出力は次のとおりです。
Compiled application.js (5ms) (pid 16431)
Compiled jquery.js (2ms) (pid 16431)
Compiled jquery_ujs.js (0ms) (pid 16431)
Compiled microposts.js (94ms) (pid 16431)
Compiled pages.js (1ms) (pid 16431)
Compiled sessions.js (0ms) (pid 16431)
Compiled users.js (0ms) (pid 16431)
Compiled application.css (17ms) (pid 16431)
Compiled blueprint/ie.css (0ms) (pid 16431)
Compiled blueprint/plugins/buttons/screen.css (0ms) (pid 16431)
Compiled blueprint/plugins/fancy-type/screen.css (0ms) (pid 16431)
Compiled blueprint/plugins/link-icons/screen.css (0ms) (pid 16431)
Compiled blueprint/plugins/rtl/screen.css (0ms) (pid 16431)
Compiled blueprint/print.css (0ms) (pid 16431)
Compiled blueprint/screen.css (0ms) (pid 16431)
Compiled blueprint/src/forms.css (0ms) (pid 16431)
Compiled blueprint/src/grid.css (0ms) (pid 16431)
Compiled blueprint/src/ie.css (0ms) (pid 16431)
Compiled blueprint/src/print.css (0ms) (pid 16431)
Compiled blueprint/src/reset.css (0ms) (pid 16431)
Compiled blueprint/src/typography.css (0ms) (pid 16431)
Compiled custom.css (0ms) (pid 16431)
Compiled microposts.css (13ms) (pid 16431)
Compiled pages.css (1ms) (pid 16431)
Compiled scaffolds.css (15ms) (pid 16431)
Compiled sessions.css (1ms) (pid 16431)
Compiled users.css (1ms) (pid 16431)
Started GET "/" for 12.13.14.15 at 2012-04-05 14:15:50 -0700
Processing by PagesController#home as HTML
Rendered pages/home.html.erb within layouts/application (1.1ms)
Rendered layouts/_stylesheets.html.erb (1.3ms)
Completed 500 Internal Server Error in 6ms
ActionView::Template::Error (blueprint/screen.css isn't precompiled):
1: <!--[if lt IE9]>
2: <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
3: <![endif]-->
4: <%= stylesheet_link_tag 'blueprint/screen', :media => 'screen' %>
5: <%= stylesheet_link_tag 'blueprint/print', :media => 'print' %>
6: <!--[if lt IE 8]><%= stylesheet_link_tag 'blueprint/ie' %><![endif]-->
7: <%= stylesheet_link_tag 'custom', :media => 'screen' %>
app/views/layouts/_stylesheets.html.erb:4:in `_app_views_layouts__stylesheets_html_erb___2010157553399413981_33056460'
app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb__4294160261947576619_31749320'
そしてここでは、デプロイファイルの:
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path.
require "rvm/capistrano" # Load RVM's capistrano plugin.
require "bundler/capistrano"
set :application, "Project"
set :scm, "git"
set :repository, "ssh://server.example.ca/usr/local/git_root/project.git"
set :user, "deploy"
#set :rvm_bin_path, "/usr/local/rvm/bin"
set :rvm_ruby_string, "[email protected]"
set :normalize_asset_timestamps, false
ssh_options[:forward_agent] = true
set :branch, "master"
set :deploy_via, :remote_cache
# If you aren't deploying to /u/apps/#{application} on the target
# servers (which is the default), you can specify the actual location
# via the :deploy_to variable:
set :deploy_to, "/usr/local/www/sites/project.example.ca/"
set :use_sudo, false
set :domain, 'project.example.ca'
role :app, domain
role :web, domain
role :db, domain, :primary => true
before "deploy:symlink", "assets:precompile"
namespace :assets do
desc "Compile assets"
task :precompile, :roles => :app do
run "cd #{release_path} && bundle exec rake RAILS_ENV=#{rails_env} assets:precompile"
end
end
は、ここに私のcapfileです:
require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
module Arbiterapi
class Application < Rails::Application
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
# Enable the asset pipeline
config.assets.enabled = true
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
# Precompile problem assets
config.assets.precompile = %w(screen.css print.css)
end
end
application.cssにwhatsを表示できますか?たぶんあなたはそこに必要なCSSファイルをすべて追加していないでしょう。ローカルのdevマシンでこの 'bundle exec rake assets:precompile'を実行して、パブリックフォルダ全体を本番サーバにコピーしてみてください。最後の手段として、config/environments/production.rbでconfig.assets.compileをtrueに設定してみてください。 – Sebi
私のapplication.cssファイルは空ですが、この自動生成されたコメントは除きます:/ * *これは、このディレクトリ *とすべてのサブディレクトリで利用可能なすべてのスタイルシートを自動的に含むマニフェストファイルです。このファイルにアプリケーション全体のスタイルを自由に追加することができ、コンパイルされたファイルの先頭である *に表示されますが、スタイルスコープごとに新しいファイルを作成する方が一般的に適しています。 * = require_self * = require_tree。 */ –
私はローカルマシン上で 'bundle exec rake assets:precompile'を介してアセットをあらかじめコンパイルしておき、私のgitリポジトリをリモートサーバにプッシュし、その後' cap deploy:update'を実行しました。このあとで、あらかじめコンパイルされたアセットは、自分のWebサーバー上のパブリックフォルダにあります。 –