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
Ruby on rails 新Rails欢迎屏幕位于何处?_Ruby On Rails_Reactjs_Webpack_Webpacker - Fatal编程技术网

Ruby on rails 新Rails欢迎屏幕位于何处?

Ruby on rails 新Rails欢迎屏幕位于何处?,ruby-on-rails,reactjs,webpack,webpacker,Ruby On Rails,Reactjs,Webpack,Webpacker,我使用以下命令创建了新的rails应用程序: rails new myapp --webpack=react webpacker:install webpacker:install:react 当我添加javascript\u pack\u标记“hello\u react”时,什么都没有发生,主页上也没有承诺的hello <!DOCTYPE html> <html> <head> <title>MyAp

我使用以下命令创建了新的rails应用程序:

rails new myapp --webpack=react
webpacker:install
webpacker:install:react
当我添加
javascript\u pack\u标记“hello\u react”
时,什么都没有发生,主页上也没有承诺的hello

    <!DOCTYPE html>
    <html>
      <head>
        <title>MyApp</title>
        <%= csrf_meta_tags %>

        <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
        <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
        <%= javascript_pack_tag 'hello_react' %>
      </head>

      <body>
        <%= yield %>
      </body>
    </html>

MyApp

我觉得这不是Rails使用的布局,因为标题是“RubyonRails”,而不是我的应用程序名。此外,react部分也没有渲染我遗漏了什么?

您能给我看一下您的组件吗?您显示的是application.html.erb文件。这基本上是你网站上所有视图的标题。创建一个控制器,创建此控制器操作的视图(只需要一个),然后您将能够看到上面的实际网页header@uzaif它是rails 5.1.2创建的默认入口组件。Maxence-我理解,但编辑默认视图(主页)也应该是一种可能。为什么不创建根
路由
并在其中添加组件,当您创建一个包含操作的新控制器时,您应该能够看到“Hello react from webpack”,比如
rails g controller home index
,当您将此操作定义为路由文件中的根时