Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Rails/Heroku应用程序错误-ActionView::Templete::错误_Ruby On Rails_Heroku_Actionview - Fatal编程技术网

Ruby on rails Rails/Heroku应用程序错误-ActionView::Templete::错误

Ruby on rails Rails/Heroku应用程序错误-ActionView::Templete::错误,ruby-on-rails,heroku,actionview,Ruby On Rails,Heroku,Actionview,当我将我的应用程序部署到Heroku时,我收到一个错误页面,上面说我们很抱歉,但出现了一些问题。我将puma添加到我的gem文件中,以便在那里运行服务器。不幸的是,这并没有解决问题。我在Cloud9IDE中工作。日志发布在下面。有人能帮忙吗 > freshmurry:~/workspace (master) $ heroku logs --tail > WARNING: This is the legacy Heroku CLI with limited functi

当我将我的应用程序部署到Heroku时,我收到一个错误页面,上面说我们很抱歉,但出现了一些问题。我将puma添加到我的gem文件中,以便在那里运行服务器。不幸的是,这并没有解决问题。我在Cloud9IDE中工作。日志发布在下面。有人能帮忙吗

>     freshmurry:~/workspace (master) $ heroku logs --tail
>     WARNING: This is the legacy Heroku CLI with limited functionality. Please install the latest CLI.
>     WARNING: Installation instructions are at https://cli.heroku.com
>     2017-06-12T14:42:28.118206+00:00 app[web.1]: => Ctrl-C to shutdown server
>     2017-06-12T14:42:28.118197+00:00 app[web.1]: => Rails 4.2.6 application starting in production on http://0.0.0.0:7296
>     2017-06-12T14:42:28.118218+00:00 app[web.1]: [4] Puma starting in cluster mode...
>     2017-06-12T14:42:28.118219+00:00 app[web.1]: [4] * Version 3.9.1 (ruby 2.2.2-p95), codename: Private Caller
>     2017-06-12T14:42:28.118220+00:00 app[web.1]: [4] * Min threads: 1, max threads: 1
>     2017-06-12T14:42:28.118223+00:00 app[web.1]: [4] * Process workers: 2
>     2017-06-12T14:42:28.118221+00:00 app[web.1]: [4] * Environment: production
>     2017-06-12T14:42:28.118246+00:00 app[web.1]: [4] * Preloading application
>     2017-06-12T14:42:28.118403+00:00 app[web.1]: [4] * Listening on tcp://0.0.0.0:7296
>     2017-06-12T14:42:28.127987+00:00 app[web.1]: [4] - Worker 0 (pid: 7) booted, phase: 0
>     2017-06-12T14:42:28.118634+00:00 app[web.1]: [4] Use Ctrl-C to stop
>     2017-06-12T14:42:28.138176+00:00 app[web.1]: [4] - Worker 1 (pid: 12) booted, phase: 0
>     2017-06-12T14:42:28.468279+00:00 heroku[web.1]: State changed from starting to up
>     2017-06-12T14:43:21.618239+00:00 app[web.1]: Started GET "/" for 165.225.0.80 at 2017-06-12 14:43:21 +0000
>     2017-06-12T14:43:21.661531+00:00 app[web.1]: Processing by ProductsController#index as HTML
>     2017-06-12T14:43:21.676339+00:00 app[web.1]:   Product Load (1.5ms)  SELECT "products".* FROM "products"
>     2017-06-12T14:43:51.612669+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/"
> host=songchordz.herokuapp.com
> request_id=a209d2c5-1519-4829-b03f-8ad410a36cc7 fwd="165.225.0.80"
> dyno=web.1 connect=1ms service=30000ms status=503 bytes=0
> protocol=https
>     2017-06-12T14:43:51.738309+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=songchordz.herokuapp.com
> request_id=716c5e18-d421-49fd-9c3f-a1b406ef950d fwd="165.225.0.80"
> dyno=web.1 connect=1ms service=11ms status=200 bytes=188
> protocol=https
>     2017-06-12T14:44:19.815485+00:00 app[web.1]:   Rendered products/index.html.erb within layouts/application (58144.2ms)
>     2017-06-12T14:44:19.815964+00:00 app[web.1]: Completed 500 Internal Server Error in 58154ms (ActiveRecord: 7.1ms)
>     2017-06-12T14:44:19.819108+00:00 app[web.1]: 
>     2017-06-12T14:44:19.819110+00:00 app[web.1]: ActionView::Template::Error (Invalid CSS after "...   background: ":
> expected "{", was "url('/assets/si..."):
>     2017-06-12T14:44:19.819112+00:00 app[web.1]:     13:     <div class="product clearfix">
>     2017-06-12T14:44:19.819113+00:00 app[web.1]:     14:    <a href="<%= product_path(product)%>">
>     2017-06-12T14:44:19.819113+00:00 app[web.1]:     15:     <div class="product-image-container">
>     2017-06-12T14:44:19.819114+00:00 app[web.1]:     16:      <img src="<%= asset_path product.thumbnail_image_name %>" alt="<%=
> product.title %>"/>
>     2017-06-12T14:44:19.819115+00:00 app[web.1]:     17:      <span class="product-price">$<%= product.price %></span>
>     2017-06-12T14:44:19.819116+00:00 app[web.1]:     18:    </div>
>     2017-06-12T14:44:19.819117+00:00 app[web.1]:     19:    <p class="product-title"><%= product.title %></p></a>
>     2017-06-12T14:44:19.819118+00:00 app[web.1]:   app/views/products/index.html.erb:16:in `block in
> _app_views_products_index_html_erb__2962215687888486859_70188315801060'
>     2017-06-12T14:44:19.819118+00:00 app[web.1]:   app/views/products/index.html.erb:12:in
> `_app_views_products_index_html_erb__2962215687888486859_70188315801060'
>     2017-06-12T14:44:19.819120+00:00 app[web.1]: 
>     2017-06-12T14:44:19.819119+00:00 app[web.1]: 
>     2017-06-12T14:50:12.196944+00:00 app[web.1]: Started GET "/" for 165.225.0.83 at 2017-06-12 14:50:12 +0000
>     2017-06-12T14:50:12.246560+00:00 app[web.1]: Processing by ProductsController#index as HTML
>     2017-06-12T14:50:12.260255+00:00 app[web.1]:   Product Load (1.6ms)  SELECT "products".* FROM "products"
>     2017-06-12T14:50:18.705756+00:00 heroku[router]: at=info method=GET path="/" host=songchordz.herokuapp.com
> request_id=cb4de3d8-9abf-4c68-b7b3-08247b55c803 fwd="165.225.0.83"
> dyno=web.1 connect=2ms service=6512ms status=500 bytes=1714
> protocol=https
>     2017-06-12T14:50:18.758818+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=songchordz.herokuapp.com
> request_id=aa8706d9-9053-40ee-b586-c95a2324af8d fwd="165.225.0.83"
> dyno=web.1 connect=1ms service=2ms status=304 bytes=93 protocol=https
>     2017-06-12T14:50:18.706025+00:00 app[web.1]:     14:    <a href="<%= product_path(product)%>">
>     2017-06-12T14:50:18.704334+00:00 app[web.1]: Completed 500 Internal Server Error in 6458ms (ActiveRecord: 9.5ms)
>     2017-06-12T14:50:18.706028+00:00 app[web.1]:     18:    </div>
>     2017-06-12T14:50:18.706020+00:00 app[web.1]: 
>     2017-06-12T14:50:18.704044+00:00 app[web.1]:   Rendered products/index.html.erb within layouts/application (6448.0ms)
>     2017-06-12T14:50:18.706026+00:00 app[web.1]:     15:     <div class="product-image-container">
>     2017-06-12T14:50:18.706026+00:00 app[web.1]:     16:      <img src="<%= asset_path product.thumbnail_image_name %>" alt="<%=
> product.title %>"/>
>     2017-06-12T14:50:18.706024+00:00 app[web.1]:     13:     <div class="product clearfix">
>     2017-06-12T14:50:18.706027+00:00 app[web.1]:     17:      <span class="product-price">$<%= product.price %></span>
>     2017-06-12T14:50:18.706023+00:00 app[web.1]: ActionView::Template::Error (Invalid CSS after "...   background: ":
> expected "{", was "url('/assets/si..."):
>     2017-06-12T14:50:18.706029+00:00 app[web.1]:     19:    <p class="product-title"><%= product.title %></p></a>
>     2017-06-12T14:50:18.706030+00:00 app[web.1]:   app/views/products/index.html.erb:16:in `block in
> _app_views_products_index_html_erb__2962215687888486859_70188315745620'
>     2017-06-12T14:50:18.706031+00:00 app[web.1]:   app/views/products/index.html.erb:12:in
> `_app_views_products_index_html_erb__2962215687888486859_70188315745620'
>     2017-06-12T14:50:18.706031+00:00 app[web.1]: 
>     2017-06-12T14:50:18.706032+00:00 app[web.1]: 
>     2017-06-12T15:00:09.000000+00:00 app[api]: Build started by user user@yahoo.com
>     2017-06-12T15:00:26.386944+00:00 app[api]: Release v35 created by user user@yahoo.com
>     2017-06-12T15:00:26.386944+00:00 app[api]: Deploy bfdfd983 by user user@yahoo.com
>     2017-06-12T15:00:27.042332+00:00 heroku[web.1]: Restarting
>     2017-06-12T15:00:27.043183+00:00 heroku[web.1]: State changed from up to starting
>     2017-06-12T15:00:09.000000+00:00 app[api]: Build succeeded
>     2017-06-12T15:00:28.141928+00:00 heroku[web.1]: Stopping all processes with SIGTERM
>     2017-06-12T15:00:28.160932+00:00 app[web.1]: [4] - Gracefully shutting down workers...
>     2017-06-12T15:00:28.933799+00:00 app[web.1]: [4] === puma shutdown: 2017-06-12 15:00:28 +0000 ===
>     2017-06-12T15:00:28.933814+00:00 app[web.1]: [4] - Goodbye!
>     2017-06-12T15:00:28.933834+00:00 app[web.1]: Exiting
>     2017-06-12T15:00:29.287412+00:00 heroku[web.1]: Process exited with status 0
>     2017-06-12T15:00:33.688417+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 10601 -e production`
>     2017-06-12T15:00:42.161643+00:00 app[web.1]: => Booting Puma
>     2017-06-12T15:00:42.161681+00:00 app[web.1]: => Rails 4.2.6 application starting in production on http://0.0.0.0:10601
>     2017-06-12T15:00:42.161691+00:00 app[web.1]: => Run `rails server -h` for more startup options
>     2017-06-12T15:00:42.161692+00:00 app[web.1]: => Ctrl-C to shutdown server
>     2017-06-12T15:00:42.161754+00:00 app[web.1]: [4] Puma starting in cluster mode...
>     2017-06-12T15:00:42.161823+00:00 app[web.1]: [4] * Version 3.9.1 (ruby 2.2.2-p95), codename: Private Caller
>     2017-06-12T15:00:42.161864+00:00 app[web.1]: [4] * Min threads: 1, max threads: 1
>     2017-06-12T15:00:42.161937+00:00 app[web.1]: [4] * Environment: production
>     2017-06-12T15:00:42.161980+00:00 app[web.1]: [4] * Process workers: 2
>     2017-06-12T15:00:42.162025+00:00 app[web.1]: [4] * Preloading application
>     2017-06-12T15:00:42.162303+00:00 app[web.1]: [4] * Listening on tcp://0.0.0.0:10601
>     2017-06-12T15:00:42.162802+00:00 app[web.1]: [4] Use Ctrl-C to stop
>     2017-06-12T15:00:42.175712+00:00 app[web.1]: [4] - Worker 0 (pid: 7) booted, phase: 0
>     2017-06-12T15:00:42.178719+00:00 app[web.1]: [4] - Worker 1 (pid: 9) booted, phase: 0
>     2017-06-12T15:00:42.741234+00:00 heroku[web.1]: State changed from starting to up
>     2017-06-12T15:03:34.480518+00:00 app[web.1]: Started GET "/" for 165.225.0.80 at 2017-06-12 15:03:34 +0000
>     2017-06-12T15:03:34.535895+00:00 app[web.1]: Processing by ProductsController#index as HTML
>     2017-06-12T15:03:34.556604+00:00 app[web.1]:   Product Load (1.7ms)  SELECT "products".* FROM "products"
>     2017-06-12T15:04:04.458759+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/"
> host=songchordz.herokuapp.com
> request_id=99da6242-45eb-4039-b35c-770b1594beec fwd="165.225.0.80"
> dyno=web.1 connect=0ms service=30001ms status=503 bytes=0
> protocol=https
>     2017-06-12T15:04:34.582637+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/favicon.ico"
> host=songchordz.herokuapp.com
> request_id=734596fb-2cb9-4bd4-9cc5-4fc85c747ed5 fwd="165.225.0.80"
> dyno=web.1 connect=0ms service=30001ms status=503 bytes=0
> protocol=https
>     2017-06-12T15:04:49.462061+00:00 app[web.1]:   Rendered products/index.html.erb within layouts/application (74910.8ms)
>     2017-06-12T15:04:49.467310+00:00 app[web.1]: Completed 500 Internal Server Error in 74931ms (ActiveRecord: 6.5ms)
>     2017-06-12T15:04:49.470398+00:00 app[web.1]: 
>     2017-06-12T15:04:49.470410+00:00 app[web.1]: ActionView::Template::Error (Invalid CSS after "...   background: ":
> expected "{", was "url('/assets/si..."):
>     2017-06-12T15:04:49.470412+00:00 app[web.1]:     13:     <div class="product clearfix">
>     2017-06-12T15:04:49.470414+00:00 app[web.1]:     14:    <a href="<%= product_path(product)%>">
>     2017-06-12T15:04:49.470415+00:00 app[web.1]:     15:     <div class="product-image-container">
>     2017-06-12T15:04:49.470415+00:00 app[web.1]:     16:      <img src="<%= asset_path product.thumbnail_image_name %>" alt="<%=
> product.title %>"/>
>     2017-06-12T15:04:49.470416+00:00 app[web.1]:     17:      <span class="product-price">$<%= product.price %></span>
>     2017-06-12T15:04:49.470418+00:00 app[web.1]:     18:    </div>
>     2017-06-12T15:04:49.470419+00:00 app[web.1]:     19:    <p class="product-title"><%= product.title %></p></a>
>     2017-06-12T15:04:49.470420+00:00 app[web.1]:   app/views/products/index.html.erb:16:in `block in
> _app_views_products_index_html_erb__4490733878524225278_70102825789420'
>     2017-06-12T15:04:49.470421+00:00 app[web.1]:   app/views/products/index.html.erb:12:in
> `_app_views_products_index_html_erb__4490733878524225278_70102825789420'
>     2017-06-12T15:04:49.470421+00:00 app[web.1]: 
>     2017-06-12T15:04:49.470422+00:00 app[web.1]:

任何时候您看到这样的错误:

2017-06-12T15:04:49.470410+00:00 app[web.1]: ActionView::Template::Error (Invalid CSS after "... background: ": > expected "{", was "url('/assets/si..."):
这是一条线索。线索在术语ActionView::Template中。了解RubyonRails框架是如何工作的对于您理解正在发生的事情很重要。以下是关于ActionView的意义的指南:

Rails使用这个名为ActionView的工具,ActionView的作用是帮助将控制器映射到视图,但不要相信我的话,只要阅读我上面发布的文档,特别是这一部分:

对于每个控制器,app/views目录中都有一个关联的目录,其中包含构成与该控制器关联的视图的模板文件。这些文件用于显示每个控制器操作产生的视图

那我为什么要发这个?好的,如果您知道ActionView将控制器映射到视图,然后您还看到术语模板,那么它可以作为一个重要线索,表明问题出在模型视图控制器应用程序的视图中。用这种方式隔离这个框架的问题不是很棒吗

然后在错误消息中还有另一个线索,无效的CSS在

我认为这是所有线索中最大和最明显的线索。您的CSS无效,并且在视图中没有正确呈现,这就是为什么术语模板和ActionView出现在错误场景中的原因


我知道你最终解决了问题,但答案也在于你如何解决问题,而不仅仅是解决问题。最终,您将遇到另一个错误,如果您不知道Ruby on Rails MVC框架及其所有工具是如何工作的,您将无法破译该错误。

我确实看到了这个错误:2017-06-12T15:04:49.470410+00:00应用程序[web.1]:ActionView::Template::error在。。。背景::>应为{,was url'/assets/si…:尝试运行heroku run rake assets:precompile以查看这是否显示您的资产中存在错误。这也有帮助…问题的根源在我的application.css.scss文件中。我必须删除css扩展名。