webpacker: Webpacker can't find application.js in D:/ROR/blog/public/packs/manifest.json in Ruby on Rails 6.1

I am new in Rails 6. I followed their document(https://guides.rubyonrails.org/getting_started.html) but I had some errors related to webpacker. I made a route on routes file(config/routes.rb)

Rails.application.routes.draw do
  get "/articles", to: "articles#index"

  # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end

And I created ArticlesController and its index action bin/rails generate controller Articles index --skip-routes

And I run the server

bin/rails server

when I visit http://localhost:3000/articles, this error happend.

Webpacker::Manifest::MissingEntryError in Articles#index

Showing D:/ROR/blog/app/views/layouts/application.html.erb where line #10 raised:

Webpacker can't find application.js in D:/ROR/blog/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:
{
}

Screenshot 2020-12-23 180722

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 6
  • Comments: 20 (2 by maintainers)

Commits related to this issue

Most upvoted comments

I ended up finding a fix for my issue through this link: https://discuss.rubyonrails.org/t/pretty-astonishing/76850

I don’t know if you are running into the same issue but it is worth a shot and maybe anyone else who stumbles here might find it useful. It seems that upon using the default installation process for RoR, it grabs a beta version of webpacker and you hit all kinds of issues because of it. Ross Kaffenberger understood the issue better so check out the link to read more from him but here were the steps to fix the issue:

$ yarn remove @rails/webpacker $ rm -rf ./node_modules $ yarn add @rails/webpacker@^5.2.1

Hopefully it works or helps anyone else who is struggling.

Hello @youthtech-228 ! 👋

I don’t have much details about your problem, but I guess (looking your printscreen) this error is occuring with you because you did not compile the assets yet. Or you dont have created the file app/javascript/packs/application.js.

Could you try execute rails webpacker:compile and refresh the page to check if the error persists? This error is commonly related to this.

If the error persist, please let me know, and then we can get some more informations to investigate the root cause 🔍

Thanks! 🤝

If you are facing this issue with error logs like this:

[Webpacker] Compiling...
[Webpacker] Compilation failed:
node:internal/crypto/hash:67
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:130:10)
    at module.exports (/home/hoseon/rails/blog/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/home/hoseon/rails/blog/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/home/hoseon/rails/blog/node_modules/webpack/lib/NormalModule.js:471:10)
    at /home/hoseon/rails/blog/node_modules/webpack/lib/NormalModule.js:503:5
    at /home/hoseon/rails/blog/node_modules/webpack/lib/NormalModule.js:358:12
    at /home/hoseon/rails/blog/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/home/hoseon/rails/blog/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at iterateNormalLoaders (/home/hoseon/rails/blog/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
    at /home/hoseon/rails/blog/node_modules/loader-runner/lib/LoaderRunner.js:236:3
    at context.callback (/home/hoseon/rails/blog/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at /home/hoseon/rails/blog/node_modules/babel-loader/lib/index.js:59:71 {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v17.2.0

Downgrade your Node to 16

This error also occurred for me when I pulled down my app locally and ran bundle install but forgot to run yarn install. There were no node_modules installed, but that wasn’t directly indicated; the error I saw was “Webpacker can’t find application.js”

yarn remove @rails/webpacker returned cannot find webpacker but then I ran yarn add @rails/webpacker@5.2.1 it exited with error error

/home/fixed/Desktop/deep_rails/node_modules/node-sass: Command failed.

but surprising enough my website started working