前提・実現したいこと
rails testを正しく動作させたい
発生している問題・エラーメッセージ
プログラミング初心者でRailsチュートリアル3章、「最初のテスト」学習中に次のようなメッセージがでてきてしまいました。
Error: StaticPagesControllerTest#test_should_get_help: ActionView::Template::Error: Webpacker can't find application in /home/ubuntu/environment/sample_app/public/packs-test/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/layouts/application.html.erb:9 test/controllers/static_pages_controller_test.rb:10:in `block in <class:StaticPagesControllerTest>' rails test test/controllers/static_pages_controller_test.rb:9 E Error: StaticPagesControllerTest#test_should_get_home: ActionView::Template::Error: Webpacker can't find application in /home/ubuntu/environment/sample_app/public/packs-test/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/layouts/application.html.erb:9 test/controllers/static_pages_controller_test.rb:5:in `block in <class:StaticPagesControllerTest>' rails test test/controllers/static_pages_controller_test.rb:4 Finished in 2.118673s, 0.9440 runs/s, 0.0000 assertions/s. 2 runs, 0 assertions, 0 failures, 2 errors, 0 skips
チュートリアル通りであればまだコードに変更を加える前なので
すべてのテストが成功するはずです
試したこと
https://note.com/hbkk/n/n032e39e19e31
上記のサイトを参考にし
$bin/yarn $bin/webpack
のコマンドを打つと
warning ../../package.json: No license field yarn run v1.22.15 warning ../../package.json: No license field error Command "webpack" not found. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
このようなエラーがでてきてしまいました。
補足情報(FW/ツールのバージョンなど)
Cloud9
Rails 6.0.3
Gemfile
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } gem 'rails', '6.0.3' gem 'puma', '4.3.6' gem 'sass-rails', '5.1.0' gem 'webpacker', '4.0.7' gem 'turbolinks', '5.2.0' gem 'jbuilder', '2.9.1' gem 'bootsnap', '1.4.5', require: false group :development, :test do gem 'sqlite3', '1.4.1' gem 'byebug', '11.0.1', platforms: [:mri, :mingw, :x64_mingw] end group :development do gem 'web-console', '4.0.1' gem 'listen', '3.1.5' gem 'spring', '2.1.0' gem 'spring-watcher-listen', '2.0.1' end group :test do gem 'capybara', '3.28.0' gem 'selenium-webdriver', '3.142.4' gem 'webdrivers', '4.1.2' gem 'rails-controller-testing', '1.0.4' gem 'minitest', '5.11.3' gem 'minitest-reporters', '1.3.8' gem 'guard', '2.16.2' gem 'guard-minitest', '2.4.6' end group :production do gem 'pg', '1.1.4' end
あなたの回答
tips
プレビュー