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:
{
}
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 6
- Comments: 20 (2 by maintainers)
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:
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 runyarn install
. There were nonode_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 ranyarn 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
Solved this here https://stackoverflow.com/a/69511508/13486752