Webpacker 在 Ruby on Rails 6 中的 D:/ROR/blog/public/packs/manifest.json 中找不到 application.js

问题描述

我是 Rails 6 的新手。 我遵循了他们的文档(https://guides.rubyonrails.org/getting_started.html),但是我遇到了一些与 webpacker 相关的错误。 我在路由文件(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

我创建了 ArticlesController 及其索引操作

bin/rails generate controller Articles index --skip-routes

然后我运行服务器

bin/rails server

当我访问 http://localhost:3000/articles 时,发生了这个错误

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

error with screenshot

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)