相关疑难解决方法(0)

blueprint/screen.css未预编译

我一直在关注Michael Hartl出色的RoR教程,但我正在使用RoR 3.1.我是RoR 3.1的新手,需要有关资产管道的帮助.这是我的问题:

在继续讨论第5.3节之前,我想我想推进Heroku,看看事情是如何发展的.令我惊讶的是"GET /"导致错误500.在我的本地开发环境中一切都很好.然后我尝试在production-environment(rails s -e production)下运行我的本地sample_app .相同的结果,错误500:

Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPrecompiledError in Pages#home

Showing /Users/john/Projects/sample_app/app/views/layouts/_stylesheets.html.erb where line #4 raised:

blueprint/screen.css isn't precompiled
Run Code Online (Sandbox Code Playgroud)

支持信息:

  1. 我把blueprint CSS目录放在vendor/assets/stylesheets下.
  2. 我按照Michael的第13.1.4节建议进行操作,并将以下内容作为我的app/views/layouts/application.html.erb:

    <!DOCTYPE html>
    <html>
      <head>
        <title><%= title %></title>
        <%= render 'layouts/stylesheets' %>
        <%= stylesheet_link_tag "application" %>
        <%= javascript_include_tag "application" %>
        <%= csrf_meta_tags %>
      </head>
      <body>
        <div class="container">
          <%= render 'layouts/header' %>
          <section class="round">
            <%= yield %>
          </section>
          <%= render 'layouts/footer' %>
        </div>
      </body>
    </html>
    
    Run Code Online (Sandbox Code Playgroud)
  3. app/views/layouts/_stylesheets.html.erb的内容:

    <!--[if lt IE 9]>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <%= …
    Run Code Online (Sandbox Code Playgroud)

ruby-on-rails asset-pipeline

37
推荐指数
1
解决办法
2万
查看次数

Rails 3.2 - 无法预编译资产

我试图预编译资产(rake assets:precompilebundle exec rake assets:precompile),但我总是得到错误

/Users/adam/.rvm/rubies/ruby-1.9.2-p290/bin/ruby /Users/adam/.rvm/gems/ruby-1.9.2-p290/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
Access denied for user 'root'@'localhost' (using password: YES)

Tasks: TOP => environment
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/Users/adam/.rvm/rubies/ruby-1.9.2-p290/b...]

Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
Run Code Online (Sandbox Code Playgroud)

有谁知道什么可能是错的?

编辑跟踪输出

rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/Users/adam/.rvm/rubies/ruby-1.9.2-p290/bin/ruby /Users/adam/.rvm/gems/ruby-1.9.2-p290/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** …
Run Code Online (Sandbox Code Playgroud)

assets precompile asset-pipeline ruby-on-rails-3.2

3
推荐指数
1
解决办法
3609
查看次数