Rails:Webpacker::Manifest::MissingEntryError in Home#index

Kha*_*lid 11 ruby-on-rails reactjs webpacker

Webpacker::Manifest::MissingEntryError in Home#index 显示 /Users/khalidhosein/Desktop/myEPKmedia/builder/khalid101/app/views/layouts/embedded_app.html.erb,其中第 7 行出现:

Webpacker can't find hello_react.js in /Users/khalidhosein/Desktop/myEPKmedia/builder/khalid101/public/packs/manifest.json. Possible causes:
1. You want to set webpacker.yml value of compile to true for your environment
   unless you are using the `webpack -w` or the webpack-dev-server.
2. webpack has not yet re-run to reflect updates.
3. You have misconfigured Webpacker's config/webpacker.yml file.
4. Your webpack configuration is not creating a manifest.
Your manifest contains:
{
  "application.js": "/packs/application-68dcba18197451fbb79e.js",
  "application.js.map": "/packs/application-68dcba18197451fbb79e.js.map"
}
Extracted source (around line #7):
5
6
7
8
9
10

    <% application_name = ShopifyApp.configuration.application_name %>
    <title><%= application_name %></title>
    <%= javascript_pack_tag 'hello_react' %>
    <%= stylesheet_link_tag 'application' %>
    <%= javascript_include_tag 'application', "data-turbolinks-track" => true %>
    <%= csrf_meta_tags %>

Rails.root: /Users/khalidhosein/Desktop/myEPKmedia/builder/khalid101

Application Trace | Framework Trace | Full Trace
app/views/layouts/embedded_app.html.erb:7:in `_app_views_layouts_embedded_app_html_erb___4509380428416253144_70127991029820'
Request
Parameters:

None
Run Code Online (Sandbox Code Playgroud)

尝试将我的 Rails 应用程序与 React 前端连接时出现此错误。我已经尝试从所有来源研究和重新配置文件。我还重新创建了 manifyingt.json 文件和包库。我正在关注本教程:

https://github.com/natemacinnes/natemacinnes.github.io/blob/master/rails-5-shopify-app-setup.md
Run Code Online (Sandbox Code Playgroud)

如果有人有任何想法,我们将不胜感激,因为没有太多的文档或教程介绍如何将 Rails Shopify API 与 React 连接起来。

我的代码----> https://github.com/KhalidH82/ShopifyApp-React-Rails

ami*_*ena 21

虽然我没有使用 react,但在新创建的 Rails 6 应用程序上遇到了同样的错误。重新安装 webpacker 为我修复了它:

bundle exec rake webpacker:install

我想这可能是一些缺少的依赖项,或者旧版本中的错误(我注意到webpack-dev-server版本已升级到3.8.1)。


Pro*_*ton 10

尝试在Ubuntu 20.04 中设置新的Rails 6应用程序时,我遇到了同样的挑战。

当我启动 rails 服务器并转到我的浏览器时,我收到错误消息:

Webpacker::Manifest::MissingEntryError in Books#index
Showing /home/promisepreston/dynamic_authorization/app/views/layouts/application.html.erb where line #9 raised:

Webpacker can't find application in /home/promisepreston/dynamic_authorization/public/packs/manifest.json. Possible causes:
1. You want to set webpacker.yml value of compile to true for your environment
   unless you are using the `webpack -w` or the webpack-dev-server.
2. webpack has not yet re-run to reflect updates.
3. You have misconfigured Webpacker's config/webpacker.yml file.
4. Your webpack configuration is not creating a manifest.
Your manifest contains:
{
Run Code Online (Sandbox Code Playgroud)

这是我修复它的方法

问题是我没有webpackerRails 6应用程序中设置。从Rails 6开始,webpacker是默认的 JavaScript 编译器。这意味着所有 JavaScript 代码都将由webpacker旧的资产管道 aka来处理sprockets

webpacker在 Rails 6 应用程序中安装,只需运行以下命令:

bundle exec rails webpacker:install
Run Code Online (Sandbox Code Playgroud)

或者

rails webpacker:install
Run Code Online (Sandbox Code Playgroud)

这应该成功安装webpacker及其所有依赖项。

就这样。

我希望这有帮助

  • `rails webpacker:install` 对我有用,坦克很多 (2认同)

Jas*_* FB 8

如果您不小心没有安装 webpacker,这种情况也可能发生在您身上。如果您尝试使用不兼容的 Node 版本安装 webpacker,则可能会发生这种情况

yarn add @rails/webpacker

注意你会得到:

% yarn add @rails/webpacker
yarn add v1.22.10
[1/4]   Resolving packages...
[2/4]   Fetching packages...
error @npmcli/fs@1.1.0: The engine "node" is incompatible with this module. Expected version "^12.13.0 || ^14.15.0 || >=16". Got "15.14.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Run Code Online (Sandbox Code Playgroud)

您会发现您的文件不会发生任何更改package.json

因为此检查现在运行(在纱线安装时)而不是在运行时运行,所以很容易错过这一点。

如果你没有注意到yarn add给了你这个错误,你会认为webpacker已经安装到你的package.json中,但实际上它还没有安装。

切换到兼容的节点版本并重新运行安装程序可以解决该问题。正如它所说,您需要的节点版本是^12.13.0 || ^14.15.0 || >=16


Sha*_*jed 5

可能是你错过了安装npm install。我遇到了你提到的完全相同的问题。只需输入npm install您的终端或Dockerfile. 我希望这个问题会得到解决。

$ npm install
Run Code Online (Sandbox Code Playgroud)