Rails: Webpacker::Manifest::MissingEntryError in Home#index
Asked Answered
G

12

25

Webpacker::Manifest::MissingEntryError in Home#index Showing /Users/khalidhosein/Desktop/myEPKmedia/builder/khalid101/app/views/layouts/embedded_app.html.erb where line #7 raised:

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

I am getting this error when trying to connect my Rails app with a React front end. I've tried researching and re-configuring files from all sources. I have also recreated manifiest.json files and packs libraries. I am following this tutorial:

https://github.com/natemacinnes/natemacinnes.github.io/blob/master/rails-5-shopify-app-setup.md

If anyone has any ideas it would be greatly appreciated as there isn't much documentation or tutorials out there going over connecting Rails Shopify API with React.

MY CODE---->https://github.com/KhalidH82/ShopifyApp-React-Rails

Genitalia answered 9/1, 2019 at 15:14 Comment(2)
bundle exec rake webpacker:compileCatamount
this post worked for me after so long if you are facing incompatibility with node version and webpacker use the command mentioned in this post https://mcmap.net/q/523603/-rails-webpacker-manifest-missingentryerror-in-home-indexCoray
N
37

Though I am not using react, but was getting the same error on a newly created Rails 6 app. Reinstalling webpacker fixed it for me:

bundle exec rake webpacker:install

I guess it probably was some missing dependency, or a bug in an older version (I noticed webpack-dev-server version was upgraded to 3.8.1).

Newmann answered 26/9, 2019 at 0:35 Comment(2)
OK since this is the top voted answer and is accurate without the whole story I will leave more clarity: there are basically 6 different reasons why this happens, nearly all of them leading to you haven't installed the Node modules using yarn install or node install. Many of the setup tools, like the installers, run those as a byproduct, which is why so many people have seen what looks like different solutions to the same root issue. I got a PR into webpacker to expand the error message (it now has 6 reasons!) based on this SO post, but now Webpacker is dead. Long live webpacker!Soloma
Using webpacker with VueJS, I had to do bundle exec rake webpacker:install:vuePrecipitous
A
22

I had to same challenge when trying to set up a new Rails 6 application in Ubuntu 20.04.

When I start the rails server, and go to my browser I get the error:

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:
{

Here's how I fixed it:

The issue was that I had not setup webpacker in the Rails 6 application. Starting with Rails 6, webpacker is the default JavaScript compiler. It means that all the JavaScript code will be handled by webpacker instead of the old assets pipeline aka sprockets.

To install webpacker in your Rails 6 application simply run the command:

bundle exec rails webpacker:install

OR

rails webpacker:install

This should successfully install webpacker and all of its dependencies.

That's all.

I hope this helps

Andes answered 6/12, 2020 at 8:44 Comment(1)
rails webpacker:install worked for me, tanks a lotUndersecretary
Z
9

may be you missed to install npm install. I faced exactly same issue which you have mention. Just type npm install in your terminal or Dockerfile. I hope this issue will be solved.

$ npm install
Zygophyllaceous answered 16/2, 2020 at 11:35 Comment(0)
S
8

This can also happen to you if you accidentally do not install webpacker. this can happen to you if you try to install webpacker with an incompatible version of Node

yarn add @rails/webpacker

notice you will get:

% yarn add @rails/webpacker
yarn add v1.22.10
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
error @npmcli/[email protected]: 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.

you'll notice no changes will be made to your package.json file.

Because this check runs now (at the yarn install time) and not during runtime, it's easy to miss this.

If you fail to notice the yarn add has given you this error, you will think webpacker has been installed into your package.json when it hasn't.

Switching to a compatible node version and rerunning the installer fixes the problem. As it says, you need node version that is ^12.13.0 || ^14.15.0 || >=16

Soloma answered 12/12, 2021 at 19:13 Comment(5)
This was my exact problem, THANK YOU! I have no idea how I was supposed to know my version of Node was outdated. I'm fairly surprised at the wide variety of solutions I'm seeing to this problem actually.Mediatize
@Mediatize -- I thought so too so I decided to fix the error message here: github.com/rails/webpacker/pull/3232 . Looks like the webpacker team will accept my PR (maybe?)Soloma
Is it necessary to delete/remove the yarn.lock file prior to this step?Freedwoman
@J.R.BobDobbs -- you definitely do not want to delete the lockfile during this step-- it is determining ALL of the JS versions loading through NPMs and you don't want to just change it around. The Webpacker::Manifest::MissingEntryError happens because Node or Yarn haven't actually or correctly installed the packages into /node_modules for you in development. in production/deployment, the pipeline builds your node modules, but it must build the exact same versions as what's in your yarn.lock, which is why you use the lockfile to dictate the versions of your node packages.Soloma
Thank you. My problem has been solved with your solution.Vickery
A
3

I was stuck with this error for a long time and none of the solutions above worked for me (try them they fix the issue 95% of the time).

For me what worked was that my version of Node was too recent. I had to downgrade it !

I was : rails Rails 6.0.4.1 and node 16.9.1.

I "downgraded" node to 12.13.0 which is a stable version. And now it works perfectly.

To "downgrade" node i followed this thread : How to downgrade Node version

Abundance answered 21/9, 2021 at 8:34 Comment(3)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Delightful
Oh. My. Goodness. I've been on this for 2 hours, and finally a solution that works. I know this kind of comment is usually frowned upon, but thankthankthankthank youWembley
For you Rails devs new to Node: the ODD Versions of Node are unstable; the EVEN versions of Node are the "stable ones". Node 12 and 14 happen to currently be in "maintenance" mode but for us Rails developers-- go with Node 14 for now. (Dec 2021). It'll take a while before all the interoperability stuff with Node 16 will be worked out. Just consider that the Node team is ahead of where the rest of us are adopting so it makes sense. I'd recommend the latest 14.x node.Soloma
S
2

I had the same error after updating to Rails 5.1 and Webpacker 5.x

https://github.com/rails/webpacker/blob/5-x-stable/docs/integrations.md#react

The command now is bundle exec rails webpacker:install:react

Savor answered 11/2, 2021 at 9:54 Comment(0)
S
2

This worked for after trying so many different solutions!

  1. yarn config set registry https://registry.npmjs.org
  2. rm yarn.lock
  3. yarn

and then install webpack again

  1. bundle exec rails webpacker:install

Github issue

Stereoscopy answered 25/6, 2021 at 10:28 Comment(0)
P
1

This is how I resolved the error in Rails 7 on Ubuntu 20

  • I install Webpacker bundle exec rake webpacker:install

  • Then I run bundle exec rails assets:precompile

`

Ptisan answered 12/10, 2022 at 17:59 Comment(1)
This solution works for me. Thanks @dennis-kamau It was failing during precompile, I found the solution for opnessl from here - #69693342Turboprop
C
0

In my case, I already had Webpacker installed for my Rails 6.0 app.

The problem was that some of my custom js files had names containing dots (eg. jquery.slimscroll.js) and they didn't seem to be compiled at all.

I don't know if this is a bug or I misconfigured something but changing the file names to new ones without dots (eg. jquery_slimscroll.js) resolved the problem.

Calisaya answered 24/12, 2020 at 10:47 Comment(0)
L
0

I had the same error on new application reinstalling the webpacker did it for me. rails webpacker:install

Lanai answered 6/5, 2021 at 19:45 Comment(0)
M
0
sudo bundle exec rails webpacker:install:react
Minuet answered 16/4, 2022 at 7:3 Comment(1)
Using VueJS: bundle exec rake webpacker:install:vuePrecipitous
C
0

Suddenly, my parallel test become failing in many feature specs. Over 30% spec failed. And in all logs I saw these strings: Rails: Webpacker::Manifest::MissingEntryError. Multiple restarting has no effect.

Then I'd run:

rm -rf public/packs-test
RAILS_ENV=test bundle exec rails webpacker:compile

It fixed! All specs become to green.

Copter answered 1/9, 2022 at 20:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.