gpt4 book ai didi

ruby-on-rails - 不是预编译在heroku .css上的rails 3.1错误

转载 作者:行者123 更新时间:2023-12-03 08:41:50 26 4
gpt4 key购买 nike

更新

我收到此错误,是因为我有一个public.css和public.js文件,未与其余的.css和.js文件一起编译。解决方案是将此行添加到production.rb文件中

# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
config.assets.precompile += %w( public.js public.css )

从注释中可以看到,所有文件名应用程序都已添加。因此,我只需要添加那些不称为应用程序的应用程序。

希望它能对某人有所帮助!

原始问题

我有这个 gem 文件
gem 'rails', '3.1.0'

group :production do
gem 'pg'
end
group :development, :test do
gem 'sqlite3'
end

gem "heroku"
gem 'thin'
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'tabulous'
gem 'json'
gem "paperclip", "~> 2.4"
gem "devise"
gem "redcarpet"

group :assets do

gem 'uglifier'
end

gem 'jquery-rails'

gem "rspec-rails", :group => [:test, :development]
group :test do
end

当我使用“git push heroku master”进行部署时,我看到了
Preparing app for Rails asset pipeline
Running: rake assets:precompile
mkdir -p /tmp/build_2m34y4hj01m4o/public/assets
mkdir -p /tmp/build_2m34y4hj01m4o/public/assets
mkdir -p /tmp/build_2m34y4hj01m4o/public/assets
mkdir -p /tmp/build_2m34y4hj01m4o/public/assets/admin
mkdir -p /tmp/build_2m34y4hj01m4o/public/assets/admin
-----> Rails plugin injection
Injecting rails_log_stdout
Injecting rails3_serve_static_assets
-----> Discovering process types
Procfile declares types -> (none)
Default types for Ruby/Rails -> console, rake, web, worker
-----> Compiled slug size is 31.2MB
-----> Launching... done, v5
http://maktaba.herokuapp.com deployed to Heroku

但是在heroku日志中,我得到了这个ActionView::Template::Error。 css没有预编译
奇怪..我想这是在看部署反馈
2011-11-23T22:59:48+00:00 app[web.1]: Rendered public/index.html.erb within layouts/first (0.7ms)
2011-11-23T22:59:48+00:00 app[web.1]: Completed 500 Internal Server Error in 30ms
2011-11-23T22:59:48+00:00 app[web.1]:
2011-11-23T22:59:48+00:00 app[web.1]: ActionView::Template::Error (public/public.css isn't precompiled):
2011-11-23T22:59:48+00:00 app[web.1]: 2: <html>
2011-11-23T22:59:48+00:00 app[web.1]: 3: <head>
2011-11-23T22:59:48+00:00 app[web.1]: 4: <title>Maktaba</title>
2011-11-23T22:59:48+00:00 app[web.1]: 5: <%= stylesheet_link_tag "public/public" %>
2011-11-23T22:59:48+00:00 app[web.1]: 6: <%= javascript_include_tag "public/public" %>
2011-11-23T22:59:48+00:00 app[web.1]: 7: <%= csrf_meta_tags %>
2011-11-23T22:59:48+00:00 app[web.1]: 8: <%= csrf_meta_tags %>
2011-11-23T22:59:48+00:00 app[web.1]: app/views/public/index.html.erb:5:in `_app_views_public_index_html_erb___1726244208117637261_45234420'
2011-11-23T22:59:48+00:00 app[web.1]: app/controllers/public_controller.rb:13:in `block (2 levels) in index'
2011-11-23T22:59:48+00:00 app[web.1]:
2011-11-23T22:59:48+00:00 app[web.1]: app/controllers/public_controller.rb:12:in `index'

你们中有人可以看到我在做什么吗?

最佳答案

  • 在本地代码
  • 上运行 bundle exec rake assets:precompile
  • 提交更改并将其部署到heroku

  • 如果这是您第一次将应用程序部署到heroku,则解决此问题后可能会遇到更多错误。让我知道发生什么事。

    关于ruby-on-rails - 不是预编译在heroku .css上的rails 3.1错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8250344/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com