2012-04-16 2 views
0

레일 앱을 배포하려고하는데 애셋이 꽉 찼습니다. 사전 컴파일 오류. 프로덕션 로그에 따르면 error는 screen.css라는 'Blueprint'CSS 스크립트에 의해 발생합니다 (아래 오류 출력에서 ​​볼 수 있듯이). 그러나 프로덕션 로그에 따르면이 자산은 실제로 미리 컴파일됩니다. 청사진에서 자산 사전 컴파일 오류가 발생했습니다. - ActionView :: Template :: Error (청사진/screen.css가 미리 컴파일되지 않았습니다.) - 내부 서버 오류 500

config.assets.precompile = %w(screen.css print.css) 

하지만 아무 소용

다음과 같이 나는 application.rb 및 설정/환경/production.rb 파일에 모두 프리 D 배열에 screen.css 및 print.css를 추가 명시 적으로 시도했습니다. 나는 또한 자산을 로컬에서 미리 컴파일하고 모든 것을 서버에 밀어 넣으려고했다. blueprint/screen.css isn't precompiled 여기 : blueprint css rails 3.1 help 과 같은 문제가 해결되지 않은 여기 남아 : Ruby on Rails 3.2 compiled assets are not working

나는이 오류를 해결하려면 다음 시도하는 것을 아무 생각 나는 여기에 설명 된 모든 제안을 시도했습니다. 어떤 도움이 대단히 감사하겠습니다! 로그 출력은 내 deploy 파일, 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' 

을 그리고 여기에 배포 파일의 : 오류 출력은 다음 여기에

load 'deploy' if respond_to?(:namespace) # cap2 differentiator 
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } 
load 'config/deploy' 
load 'deploy/assets' 

application.rb 설정 파일입니다 :

여기
$:.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 
+0

application.css에 whats를 표시 할 수 있습니까? 어쩌면 거기에 필요한 모든 CSS 파일을 추가하지 않은 것일 수 있습니다. 로컬 dev 머신에서이'bundle exec rake assets : precompile'을 실행 한 다음 전체 공용 폴더를 프로덕션 서버로 복사 해보실 수 있습니까? 또한 최후의 수단으로 config/environments/production.rb에서 config.assets.compile을 true로 설정하십시오. – Sebi

+0

내 application.css 파일이 비어 있지만 자동 생성 된 주석은 제외합니다./* *이 디렉토리에 사용 가능한 모든 스타일 시트가 자동으로 포함되는 매니페스트 파일입니다. * 및 하위 디렉토리. 이 파일에 응용 프로그램 전체 스타일을 자유롭게 추가 할 수 있으며 컴파일 된 파일의 상단 인 *에 나타납니다. 그러나 일반적으로 스타일 범위 당 새 파일을 만드는 것이 좋습니다. * = require_self * = require_tree. */ –

+0

이미 로컬 컴퓨터에서'bundle exec rake assets : precompile'을 통해 애셋을 미리 컴파일하고 내 git 저장소를 원격 서버로 밀어 넣고'cap deploy : update'를 실행했습니다. 이 후, 미리 컴파일 된 모든 애셋은 필자의 웹 서버의 공용 폴더에 있습니다. –

답변

0

같은 문제가 발생했습니다. 그러나 필자의 누락 된 자산은 application.js (모든 파일을 병합하기 때문에)로 컴파일되었으므로 특정 파일 (내 경우에는 webcam.js)에 대한 참조 만 제거하면됩니다.

파일이 application.css 등에 병합됩니다.