0

我正在尝试在我的应用程序上设置 gem 'react-rails',遵循https://github.com/reactjs/react-rails

bundle install
rails webpacker:install
rails webpacker:install:react

他设置了

app/javascript/components/ directory for your React components
 ReactRailsUJS setup in app/javascript/packs/application.js
 app/javascript/packs/server_rendering.js for server-side rendering

但是当我启动时

rails generate react:install

它发送此警告

Running via Spring preloader in process 34494
       exist  app/javascript/components
   identical  app/javascript/components/.keep
warning " > @babel/preset-react@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".                                                                                           
warning "@babel/preset-react > @babel/plugin-transform-react-display-name@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".                                                 
warning "@babel/preset-react > @babel/plugin-transform-react-jsx@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".                                                          
warning "@babel/preset-react > @babel/plugin-transform-react-jsx-development@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".                                              
warning "@babel/preset-react > @babel/plugin-transform-react-jsx-self@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".                                                     
warning "@babel/preset-react > @babel/plugin-transform-react-jsx-source@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".                                                   
warning "@babel/preset-react > @babel/plugin-transform-react-pure-annotations@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".                                             
warning "@babel/preset-react > @babel/plugin-transform-react-jsx > @babel/plugin-syntax-jsx@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".                               
warning " > webpack-dev-server@3.11.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".                                                                                        
warning "webpack-dev-server > webpack-dev-middleware@3.7.2" has unmet peer dependency "webpack@^4.0.0".                                                                             
File unchanged! The supplied flag value not found!  app/javascript/packs/application.js
   identical  app/javascript/packs/server_rendering.js

而且我的本地主机渲染不起作用,并发送给我:

undefined method `react_component' for #<#<Class:0x00007f9270ab7e80>:0x00007f9270ecd448>

有没有人暗示?

4

1 回答 1

0

我已经解决了部分问题:我通过退出并回到我的终端来管理。但现在它无法正确读取 react_component :

27:        <h1><%= react_component ("Coucou", { greeting: "Pipi" }) %></h1>
app/views/layouts/application.html.erb:27: syntax error, unexpected ',', expecting ')'
app/views/layouts/application.html.erb:27: syntax error, unexpected '}', expecting ')'
于 2020-06-04T10:35:37.167 回答