蓝图CSS中的资产预编译错误-ActionView :: Template :: Error(未预编译blueprint/screen.css)-内部服务器错误500 [英] asset precompilation error from blueprint css - ActionView::Template::Error (blueprint/screen.css isn't precompiled) - Internal Server Error 500
问题描述
我正在尝试部署Rails应用程序,但是我遇到了资产预编译错误.根据生产日志,该错误是由名为"screen.css"的蓝图" css脚本引起的(如下面的错误输出所示).但是,根据生产日志,实际上确实对该资产进行了预编译.我已经尝试将application.rb和config/environments/production.rb文件中的screen.css和print.css显式添加到预编译数组中,如下所示
I'm trying to deploy a rails app but I'm stuck with an asset pre-compilation error. According to the production log the error is being caused by a 'Blueprint' css script called screen.css (as you can see in the error output below). However according to the production log, this asset does in fact get pre-compiled. I've tried explicitly adding screen.css and print.css to the precompile array, both in the application.rb and config/environments/production.rb files as follows
config.assets.precompile = %w(screen.css print.css)
但无济于事.我还尝试过在本地预编译资产,然后将整个内容推送到服务器.我已经尝试过这里列出的所有建议: blueprint/screen.css未预先编译 和这里: blueprint css rails 3.1 help 并且相同的问题在这里仍未解决: Ruby on Rails 3.2编译后的资产不起作用
but to no avail. I've also tried precompiling my assets locally and pushing the whole thing to the server. I've tried all the suggestions outlined here: blueprint/screen.css isn't precompiled and here: blueprint css rails 3.1 help and the same problem remains unresolved here: Ruby on Rails 3.2 compiled assets are not working
我不知道下一步该如何解决此错误.任何帮助将不胜感激!下面是日志输出,以及我的部署文件,帽文件和application.rb文件.预先感谢您的任何建议!
I have no idea what to try next to resolve this error. Any help would be hugely appreciated! The log output is below, along with my deploy file, cap file and application.rb file. Thanks in advance for any suggestions you might have!
这是部署后日志文件的一些输出,您可以在其中看到screen.css被预先编译.错误输出如下:
Here's some output from the log file after deploy where you can see that screen.css gets pre-compiled. The error output follows:
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, "ruby-1.9.2-p290@project"
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:
Here's my capfile:
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配置文件:
Here's the application.rb config file:
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.js中(因为它合并了所有文件),因此我只需要删除对特定文件(在我的情况下为webcam.js)的引用.
I ran into the same problem. But it turns out my missing asset was compiled into application.js (as it merges all files), so I simply had to remove the reference to the specific file (webcam.js in my case).
您的文件已合并到application.css等中
Your files are merged into application.css etc...
这篇关于蓝图CSS中的资产预编译错误-ActionView :: Template :: Error(未预编译blueprint/screen.css)-内部服务器错误500的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!