问题描述
我使用 rails new
和 --webpack=react
开始了一个 rails 项目.
I've started a rails project using rails new
with --webpack=react
.
我在 database.yml 中生成了一个新的控制器更新了我的 PostgreSQL 密码.
I generated a new controller updated my PostgreSQL password in the database.yml.
到目前为止,一切正常.在这一点上,我要做的就是让 react 渲染默认的 hello_react.jsx 文件,该文件是由 rails 作为示例生成的.
Up to this point, everything works fine. At this point all I'm trying to do is get react to render the default hello_react.jsx file that was generated as an example by rails.
当我将 <%= javascript_pack_tag 'hello_react' %>
放在我的视图中并运行服务器时,我收到以下错误:
When I put <%= javascript_pack_tag 'hello_react' %>
in my view and run the server I get the following error:
Webpacker::Manifest::MissingEntryError in Home#index ShowingG:/../../../myGroceryList/app/views/home/index.html.erb where line #1提出:
Webpacker 找不到 hello_react.jsG:/../../../myGroceryList/public/packs/manifest.json.可能的原因:
Webpacker can't find hello_react.js inG:/../../../myGroceryList/public/packs/manifest.json. Possible causes:
您想将 compile 的 webpacker.yml 值设置为 true环境,除非您使用 webpack -w 或webpack 开发服务器.webpack 尚未重新运行以反映更新.你错误配置了 Webpacker 的 config/webpacker.yml 文件.你的网络包配置没有创建清单.您的清单包含:{ }
You want to set webpacker.yml value of compile to true for yourenvironment unless you are using the webpack -w or thewebpack-dev-server. webpack has not yet re-run to reflect updates. Youhave misconfigured Webpacker's config/webpacker.yml file. Your webpackconfiguration is not creating a manifest. Your manifest contains: { }
我已将 项目推送到 GitHub. 对出了什么问题的任何想法以及如何修复此错误?
I have pushed the project up to GitHub. Any thought on what is going wrong and how to fix this error?
已解决:在评论中解决
推荐答案
解决方案:我只能告诉你,当您的 public/packs 文件夹缺少 Manifest 文件或全部丢失时,会触发此错误.在我的情况下发生的事情是 Webpackers 编译步骤默默地失败并且没有创建 public/packs 文件夹.为此,我检查了 webpacker gem 的修复程序.您可以在此处查看修复和对话.
RESOLUTION: As best I can tell this error fires when your public/packs folder is missing the Manifest file or is missing all together. What was happening in my case was Webpackers compilation step was silently failing and not creating the public/packs folder. I checked in a fix to the webpacker gem for this. You can see that fix and conversation here.
这篇关于Webpacker::Manifest::MissingEntryError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!