現象
rails sでhttp://localhost:3000/にアクセスするとWebpacker::Manifest::MissingEntryErrorのエラーが表示されます。
ネットで調べてみるといろいろ解決方法が乗っているのですが、どれを試しても解決しません。
もし解決しそうな可能性のある方法をご存知でしたら教えていただきたいです。
エラー内容
Webpacker::Manifest::MissingEntryError at /
Webpacker can't find controllers/home.js in /Users/taishiito/rails-minimum-skill-check/public/packs/manifest.json. Possible causes:
- You want to set webpacker.yml value of compile to true for your environment
unless you are using thewebpack -w
or the webpack-dev-server. - webpack has not yet re-run to reflect updates.
- You have misconfigured Webpacker's config/webpacker.yml file.
- Your webpack configuration is not creating a manifest.
Your manifest contains:
{
}
rails sしている最中のターミナルのログ
Started GET "/" for ::1 at 2021-04-04 11:06:52 +0900 (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC Processing by HomeController#index as HTML Parameters: {"locale"=>"en"} Rendering home/index.html.haml within layouts/application [Webpacker] Compiling... [Webpacker] Compilation failed: yarn run v1.22.10 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. warning package.json: No license field warning package.json: No license field error Command "webpack" not found. Rendered home/index.html.haml within layouts/application (1165.5ms) Completed 500 Internal Server Error in 1178ms (ActiveRecord: 0.0ms) Webpacker::Manifest::MissingEntryError - Webpacker can't find controllers/home.js in /Users/taishiito/rails-minimum-skill-check/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: { }: app/views/home/index.html.haml:2:in `_app_views_home_index_html_haml___265118699086114215_60680' Started POST "/__better_errors/b3bfe9404eca366c/variables" for ::1 at 2021-04-04 11:06:53 +0900 Since there is no EDITOR or BETTER_ERRORS_EDITOR environment variable, using Textmate by default.
app/views/home/index.html.haml
-# Needs js suffix if exists same dirs = javascript_pack_tag 'controllers/home.js' %div{style: "min-height:600px;"} %h4 Toppage #home-app %el-row %el-col{":md": "12"} %el-progress{":percentage": "50"} %el-col{":md": "12"} %el-tag{"type": "success"} Tag 2 %el-select{"v-model": "selectedValue"} %el-option{"v-for": "item in [{value: 'v-a', label: 'v-l'}]", ":key": "item.value", ":label": "item.label", ":value": "item.value"} {{message2}} {{selectedValue}} %sample %router-link{"to": "/page1"} Page1 \| %router-link{"to": "/page2"} Page2 %router-view{"v-bind:message2": "message2"}
home_controller
class HomeController < ApplicationController def index if user_signed_in? redirect_to dashboard_path else if Rails.env == 'production' redirect_to new_user_session_path end end end end
Gemfile
source 'https://rubygems.org' git_source(:github) do |repo_name| repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") "https://github.com/#{repo_name}.git" end ruby '2.7.2' gem 'rails', '~> 5.2.4' gem 'pg', '~> 0.18' gem 'puma', '~> 3.12' gem 'sass-rails', '~> 5.0' gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.2' gem 'jquery-rails' gem 'jbuilder', '~> 2.5' gem 'hamlit' gem "devise" gem 'bootstrap-sass' gem 'rest-client' gem 'webpacker' group :production do gem 'rails_12factor' gem 'dalli' gem 'newrelic_rpm' end group :development, :test do gem 'pry-rails' gem 'pry-byebug' gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] end group :development do gem 'web-console', '>= 3.3.0' gem 'listen', '>= 3.0.5', '< 3.2' gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' gem 'better_errors' gem 'rails_layout' end group :test do gem 'capybara' gem 'database_cleaner' gem 'launchy' gem 'factory_bot_rails' gem 'rspec-rails' end gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
試してみたこと(これらは全て試しましたが、エラー内容は多少変われど解決しませんでした)
・Railsのバージョンを6に上げてみる
・yarnのバージョン変更(参考)
・nodeのバージョン変更(参考)
・「bundle exec rails webpacker:install」の実行(参考)
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。