Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/22.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/8/logging/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 ActionView::Template::错误对象不受支持_Ruby On Rails_Ruby_Actionview - Fatal编程技术网

Ruby on rails ActionView::Template::错误对象不受支持

Ruby on rails ActionView::Template::错误对象不受支持,ruby-on-rails,ruby,actionview,Ruby On Rails,Ruby,Actionview,我一直在努力寻找这个问题的答案,显然我还没有找到答案。我试着编写了我的第一个小代码,我可以毫无问题地打开服务器,但当我打开它时,服务器告诉我: TypeError:对象不支持此属性或方法 提取的源(第7行附近): CTYPE html> 程序101 在我的命令提示中,当出现错误时,它会给出以下信息: ActionView::Template::Error (TypeError: Object doesn't support this property or method): 4:

我一直在努力寻找这个问题的答案,显然我还没有找到答案。我试着编写了我的第一个小代码,我可以毫无问题地打开服务器,但当我打开它时,服务器告诉我: TypeError:对象不支持此属性或方法 提取的源(第7行附近):

CTYPE html>
程序101
在我的命令提示中,当出现错误时,它会给出以下信息:

ActionView::Template::Error (TypeError: Object doesn't support this property or method):
    4:     <title>APP</title>
    5:     <%= csrf_meta_tags %>
    6:
    7:     <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
    8:     <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
    9:   </head>
   10:

app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb__332994069_78270120'
  Rendering C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout
  Rendering C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
  Rendered C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (60.1ms)
  Rendering C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
  Rendered C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (32.6ms)
  Rendering C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
  Rendered C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (3.0ms)
  Rendered C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout (5146.8ms)
ActionView::Template::Error(TypeError:Object不支持此属性或方法):
4:应用程序
5:     
6:
7:     
8:     
9:   
10:
app/views/layouts/application.html.erb:7:in`_app\u views\u layouts\u application\u html\u erb\u 332994069\u 78270120'
呈现C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action\u dispatch/middleware/templates/rescues/template\u error.html.erb在rescues/layout中
渲染C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action\u dispatch/middleware/templates/rescues//u source.html.erb
呈现C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action\u dispatch/middleware/templates/rescues//u source.html.erb(60.1ms)
渲染C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action\u dispatch/middleware/templates/rescues//u trace.html.erb
呈现C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action\u dispatch/middleware/templates/rescues//u trace.html.erb(32.6ms)
呈现C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action\u dispatch/middleware/templates/rescues//u request\u and\u response.html.erb
呈现C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action\u dispatch/middleware/templates/rescues//u request\u and\u response.html.erb(3.0ms)
呈现C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action\u dispatch/middleware/templates/rescues/template\u error.html.erb(5146.8ms)

提前感谢您

您需要将第6行和第7行中的“应用程序”更改为“默认”


我认为这对理解问题有一些很好的细节。我遇到了确切的问题,并跟踪了堆栈跟踪,似乎原因来自
execjs
。然而,不同之处在于更改
运行时.rb
并不能解决问题。删除
/=require\u树。
确实可以解决问题,但这也不是正确的解决方案,因为它是快速解决方案


一个有效的解决方案是安装Node,我认为这可以解决问题。我可以确认这为我解决了问题。我认为这与
runtimes.rb
文件以及Windows上默认的JS env如何糟糕有关。

这显然是错误的。错误会消失,但现在你的应用程序中没有样式表/JavaScript。鉴于错误来自样式表包含行,你能将样式表添加到问题中吗?这不是同一个错误,因此,我怀疑修复是否相同。我不确定这是否是相同的错误,因为我的错误与此相同,即样式表在加载时有问题,但当我从
/=require\u树中删除
/=require\u树时。
application.js
中删除时,问题就消失了。快速解决方案是相同的。这是避免问题的另一种方法,而不是实际解决问题。如果你想在你的应用程序中使用JavaScript,不要这样做。好吧,在尝试了更多的东西并澄清之后,我改变了我的答案。请不要投反对票,我尽力了
ActionView::Template::Error (TypeError: Object doesn't support this property or method):
    4:     <title>APP</title>
    5:     <%= csrf_meta_tags %>
    6:
    7:     <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
    8:     <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
    9:   </head>
   10:

app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb__332994069_78270120'
  Rendering C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout
  Rendering C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
  Rendered C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (60.1ms)
  Rendering C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
  Rendered C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (32.6ms)
  Rendering C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
  Rendered C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (3.0ms)
  Rendered C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout (5146.8ms)