本地预编译的Heroku资产没有在heroku上显示

时间:2018-04-28 00:46:49

标签: ruby-on-rails ruby heroku

在本地对资产进行了几次测试并使用生产环境进行本地预编译后,我决定部署到heroku。但首先我从公共文件夹提交和部署中删除了资产。

在部署图像后,css和javascript没有在heroku上显示。

我试图在终端上预先编译它,但也没有显示。

我搜索了heroku文档,但没有找到与之相关的任何内容。

知道heroku的人可以帮忙吗?

rake assets:precompile RAILS_ENV=production on ⬢ app... up, run.6445 (Free)
Yarn executable was not detected in the system.
Download Yarn at https://yarnpkg.com/en/docs/install

I, [2018-04-28T00:34:53.297091 #4]  INFO -- : Writing /app/public/assets/application-6530ec3783a5066dace59576978030c61110e689042a33aaabfa02bab8729a22.js
I, [2018-04-28T00:34:53.298286 #4]  INFO -- : Writing /app/public/assets/application-6530ec3783a5066dace59576978030c61110e689042a33aaabfa02bab8729a22.js.gz
I, [2018-04-28T00:34:53.404455 #4]  INFO -- : Writing /app/public/assets/application-888a5e4ac602e29fa84543f0d08fdf1f1f8821de0be9809aabb90dd2b5ac27ad.css
I, [2018-04-28T00:34:53.405133 #4]  INFO -- : Writing /app/public/assets/application-888a5e4ac602e29fa84543f0d08fdf1f1f8821de0be9809aabb90dd2b5ac27ad.css.gz







2018-04-28T01:02:42.479552+00:00 app[web.1]: [d7e41abe-2ebd-45bd-837f-04c140203f42] vendor/bundle/ruby/2.3.0/gems/rack-2.0.5/lib/rack/sendfile.rb:111:in `call'
2018-04-28T01:02:42.479553+00:00 app[web.1]: [d7e41abe-2ebd-45bd-837f-04c140203f42] vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:522:in `call'
2018-04-28T01:02:42.479555+00:00 app[web.1]: [d7e41abe-2ebd-45bd-837f-04c140203f42] vendor/bundle/ruby/2.3.0/gems/puma-3.11.4/lib/puma/configuration.rb:225:in `call'
2018-04-28T01:02:42.479556+00:00 app[web.1]: [d7e41abe-2ebd-45bd-837f-04c140203f42] vendor/bundle/ruby/2.3.0/gems/puma-3.11.4/lib/puma/server.rb:632:in `handle_request'
2018-04-28T01:02:42.479576+00:00 app[web.1]: [d7e41abe-2ebd-45bd-837f-04c140203f42] vendor/bundle/ruby/2.3.0/gems/puma-3.11.4/lib/puma/server.rb:446:in `process_client'
2018-04-28T01:02:42.479578+00:00 app[web.1]: [d7e41abe-2ebd-45bd-837f-04c140203f42] vendor/bundle/ruby/2.3.0/gems/puma-3.11.4/lib/puma/server.rb:306:in `block in run'
2018-04-28T01:02:42.479579+00:00 app[web.1]: [d7e41abe-2ebd-45bd-837f-04c140203f42] vendor/bundle/ruby/2.3.0/gems/puma-3.11.4/lib/puma/thread_pool.rb:120:in `block in spawn_thread'
2018-04-28T01:02:42.427445+00:00 heroku[router]: at=info method=GET path="/assets/sqre-14c09561486ba385a8a62bc0a8b41e03638a6334648113a7f28be47271eccb5e.png" host=app.herokuapp.com request_id=bce0c62c-3568-44e4-adeb-74ed17691890 fwd="186.237.160.170" dyno=web.1 connect=1ms service=3ms status=404 bytes=1902 protocol=https
2018-04-28T01:02:42.480067+00:00 heroku[router]: at=info method=GET path="/assets/iore-583714033cab0d76045a8d4bbfb2326983f40d5c2cfa239e9527da9617686e6b.png" host=app.herokuapp.com request_id=d7e41abe-2ebd-45bd-837f-04c140203f42 fwd="186.237.160.170" dyno=web.1 connect=0ms service=2ms status=404 bytes=1902 protocol=https
2018-04-28T01:02:42.466234+00:00 heroku[router]: at=info method=GET path="/assets/application-888a5e4ac602e29fa84543f0d08fdf1f1f8821de0be9809aabb90dd2b5ac27ad.css" host=app.herokuapp.com request_id=e083a6e2-dfd7-4d75-ae15-dac0eeaa7e1e fwd="186.237.160.170" dyno=web.1 connect=0ms service=2ms status=404 bytes=1902 protocol=https

2 个答案:

答案 0 :(得分:1)

在部署应用之前或应用时,需要遵守资产。根据我的经验,这通常使用Heroku buildpack来完成。

看这里 https://devcenter.heroku.com/articles/ruby-support#rails-4-x-applications

https://devcenter.heroku.com/articles/buildpacks

答案 1 :(得分:-1)

如果您通过Heroku客户端工具自行预编译,则应重新启动dynos以查看更改。试试heroku restart,看看它是否有效