Webpacker: Webpacker::Manifest::MissingEntryError

Created on 4 Oct 2018  ·  24Comments  ·  Source: rails/webpacker

I've started a rails project using the rails new and --webpack=react. I generated a new controller updated my postgresql password in the database.yml. 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 the was generated as an example by rails. When I put the <%= javascript_pack_tag 'hello_react' %> in my view and run the server I get the following error.

Webpacker::Manifest::MissingEntryError in Home#index
Showing G:/../../../myGroceryList/app/views/home/index.html.erb where line #1 raised:

Webpacker can't find hello_react.js in G:/../../../myGroceryList/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:
    {
    }

I have pushed the project up to github. Any thought on what is going wrong?

UPDATE: I've posted the same question on Stackoverflow. There is a bit more discussion there that might help.

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.

Most helpful comment

Nothing work for me on Rails 6.0.3.2 except yarn add @rails/webpacker and then rails server

All 24 comments

Hey there! I cloned down your branch and after fiddling with postgres and getting everything to run on my machine I was able to get "Hello React" to run on my computer.

~/t/groceryList ❯❯❯ bundle exec rails s
=> Booting Puma
=> Rails 5.2.1 application starting in development 
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.12.0 (ruby 2.4.1-p111), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
Started GET "/" for 127.0.0.1 at 2018-10-04 12:20:55 -0500
Processing by HomeController#index as HTML
  Rendering home/index.html.erb within layouts/application
[Webpacker] Compiling…
[Webpacker] Compiled all packs in /Users/cm046531/tmp/groceryList/public/packs
  Rendered home/index.html.erb within layouts/application (2731.9ms)
Completed 200 OK in 4897ms (Views: 4888.2ms | ActiveRecord: 0.0ms)

How are you running your application and do you have more information?

It was node. I forgot to run npm install.

Btw webpacker uses yarn by default, so be aware that unless you do extra configuration it will try and leverage that 👍

I'm a little hazy on the details of specifics of yarn vs npmbut my project seems to be using both. Am I going to run into issues later or do i actually need both?

Right now Yarn replaces npm, yarn came out after npm and so it's fully compatible with it. You might run into issues if you're using both, especially since they both modify the node_modules directory. It's recommended that you use Yarn

@corymcdonald, the npm install isn't fixing my issue at home. However, I've noticed that after compiling the pack folder isn't generated. I think that's why the missing manifest error ends up firing which makes this error I'm seeing kind of a red herring. Any reason why webpack compiling would not generate the pack folder while still thinking it succeeded?

My console is showing the following:

bundle exec rails s
=> Booting Puma
=> Rails 5.2.1 application starting in development
=> Run `rails server -h` for more startup options
*** SIGUSR2 not implemented, signal based restart unavailable!
*** SIGUSR1 not implemented, signal based restart unavailable!
*** SIGHUP not implemented, signal based logs reopening unavailable!
Puma starting in single mode...
* Version 3.12.0 (ruby 2.3.3-p222), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
Started GET "/" for 127.0.0.1 at 2018-10-04 22:28:08 -0400
Processing by HomeController#index as HTML
  Rendering home/index.html.erb within layouts/application
[Webpacker] Compiling…
[Webpacker] Compiled all packs in C:/Users/.../RubymineProjects/myGroceryList/public/packs
  Rendered home/index.html.erb within layouts/application (1634.6ms)
Completed 500 Internal Server Error in 1800ms (ActiveRecord: 0.0ms)



ActionView::Template::Error (Webpacker can't find hello_react.js in C:/Users/.../RubymineProjects/myGroceryList/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:
{
}
):
    1: <%= javascript_pack_tag 'hello_react' %>

app/views/home/index.html.erb:1:in `_app_views_home_index_html_erb__818255965_34497756'

Last line of Stack Trace:
webpacker (3.5.5) lib/webpacker/manifest.rb:44:inhandle_missing_entry'`

I think there's probably something going on that's hidden by the stdout. If you find the gem by running bundle show webpacker and then open that directory and modify the file lib/webpacker/compiler.rb on line 70 to include something like

if status.success?
  logger.info "Compiled all packs in #{config.public_output_path}"
  logger.info stdout
else
  logger.error "Compilation failed:\n#{sterr}\n#{stdout}"
end

We made this change to include the ability to log the output in master recently but It's not in the 3.x version
https://github.com/rails/webpacker/blob/96144bae327909800263e9ace6329c4cc38987ec/lib/webpacker/compiler.rb#L73

Perhaps, we can backport this too to 3.x.

I think there's probably something going on that's hidden by the stdout. If you find the gem by running bundle show webpacker and then open that directory and modify the file lib/webpacker/compiler.rb on line 70 to include something like

if status.success?
  logger.info "Compiled all packs in #{config.public_output_path}"
  logger.info stdout
else
  logger.error "Compilation failed:\n#{sterr}\n#{stdout}"
end

We made this change to include the ability to log the output in master recently but It's not in the 3.x version
webpacker/lib/webpacker/compiler.rb

Line 73 in 96144ba

logger.info stdout if config.webpack_compile_output?

Awesome! I'll try this.

I got it working. The stdout turned out to be an empty string so I check sterr and I found my answer. "'C:/Users/Jon' is not recognized as an internal or external command,\noperable program or batch file.\n"
Rubymine creates projects in the user folder and my user folder has a space in the name "Jon Blewitt". I moved it out of the user folder and reran everything and it compiles fine. Would it also be a good idea to add the sterr to logger.info? Do you think this is a bug? Should I leave this issue open or close it and open another?

I'm wondering why the status variable when assigned from Open3.capture3. That seems like an undesirable effect. I'm wondering if we should check if stderr is nil/empty.

That would have been really useful. I'd love to fix this a submit a pull request but I've never contributed to anything before so I'm not familiar with the process.

It would be awesome if you could submit a PR for it ☺️

First steps would be to read the Contributing guide. Then create a fork and push up to a branch there. Then you can submit a PR 👍

@corymcdonald, alright, I'll give it a shot. Also, even though I got the error resolved should I open a seperate issue around spaced folder names causing issues?

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.

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 reconfiguring 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.

Thanks in advance!

@KhalidH82, without seeing your project it could be hard to figure this out but I will give it a shot. Since your packs file is there I take it that webpack compiled without error. If you haven't already, I think you should be able to delete your packs folder completely and then let webpacker recompile. It should regenerate your packs folder again. Another thought, Is the extension on your react hello_world file .jsx? Finally, do you have the javascript_pack_tag in your home view?

@Jonny-B , Thanks for getting back to me. I have tried deleting and recompiling the packs folder by running bin/rake webpacker:install. The extension on my hello_world file is .jsx and I have confirmed my javascript_pack_tag in home view. I've created a public repo on GH if you can take a look that would be great! GH repo.

I add this error too, without logging. I put a breakpoint inside compiler.rb and printed sterr and it showed that I'm missing webpack-cli
I think we should change lins 65-70 to this:

      if sterr
        logger.error "Compilation failed:\n#{sterr}\n#{stdout}"
      else
        logger.info "Compiled all packs in #{config.public_output_path}"
        logger.info stdout if config.webpack_compile_output?
      end

I got the same error just now.

In my case, it seemed to be that another project already had webpack-dev-server running, so the port was already taken. But the exception didn't make that clear. I found out by trying to run webpack-dev-server manually and getting a "port in use" error. More details in https://stackoverflow.com/a/59069041/6962.

I'll open an issue to suggest some improvements in this situation. UPDATE: https://github.com/rails/webpacker/issues/2378

Same error here on Rails 6. Tried adding public/packs folder but to no avail. What to do?

Nothing work for me on Rails 6.0.3.2 except yarn add @rails/webpacker and then rails server

Followed @mehmoodak's solution on Rails 6.0.3.2
yarn add @rails/webpacker and then ran rails server

It works! Thanks

Just created a new Rails 6.0.3.3 with --webpack==vue and the only way to run bin/webpack-dev-server was doing yarn add @rails/webpacker also.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

naps62 picture naps62  ·  3Comments

iChip picture iChip  ·  3Comments

inopinatus picture inopinatus  ·  3Comments

suhomlineugene picture suhomlineugene  ·  3Comments

FrankFang picture FrankFang  ·  3Comments