前提・実現したいこと
M1チップ搭載のmacbookにてRails tutorialを学習しております。
第3章 3.3.1「最初のテスト」にて
デフォルトでtest/controllers/static_pages_controller_test.rbファイルに置いてあるテストを
rails testコマンドで実行し、検証するという内容ですが、
コマンドを実行したところ以下のようなエラーが発生いたしました。
発生している問題・エラーメッセージ
/Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:34:in `require': cannot load such file -- rexml/document (LoadError) from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `block in require' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/selenium-webdriver-3.142.7/lib/selenium/webdriver/firefox.rb:22:in `<main>' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `block in require' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/webdrivers-4.6.1/lib/webdrivers/geckodriver.rb:72:in `<main>' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `block in require' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/webdrivers-4.6.1/lib/webdrivers.rb:4:in `<main>' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bundler-2.2.27/lib/bundler/runtime.rb:60:in `block (2 levels) in require' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bundler-2.2.27/lib/bundler/runtime.rb:55:in `each' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bundler-2.2.27/lib/bundler/runtime.rb:55:in `block in require' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bundler-2.2.27/lib/bundler/runtime.rb:44:in `each' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bundler-2.2.27/lib/bundler/runtime.rb:44:in `require' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bundler-2.2.27/lib/bundler.rb:174:in `require' from /Users/...../environment/sample_app/config/application.rb:7:in `<top (required)>' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/spring-3.0.0/lib/spring/application.rb:92:in `require' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/spring-3.0.0/lib/spring/application.rb:92:in `preload' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/spring-3.0.0/lib/spring/application.rb:155:in `serve' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/spring-3.0.0/lib/spring/application.rb:143:in `block in run' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/spring-3.0.0/lib/spring/application.rb:137:in `loop' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/spring-3.0.0/lib/spring/application.rb:137:in `run' from /Users/...../.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/spring-3.0.0/lib/spring/application/boot.rb:19:in `<top (required)>' from <internal:/Users/...../.rbenv/versions/3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require' from <internal:/Users/...../.rbenv/versions/3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require' from -e:1:in `<main>'
###デフォルトファイル(test/controllers/static_pages_controller_test.rb)の中身
require "test_helper" class StaticPagesControllerTest < ActionDispatch::IntegrationTest test "should get home" do get static_pages_home_url assert_response :success end test "should get help" do get static_pages_help_url assert_response :success end end
現在のgemfile
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '3.0.0' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main' gem 'rails', '~> 6.1.4', '>= 6.1.4.1' # Use Puma as the app server gem 'puma', '~> 5.0' gem 'pg', '1.0.0' # Use SCSS for stylesheets gem 'sass-rails', '>= 6' # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker gem 'webpacker', '~> 5.0' # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks gem 'turbolinks', '~> 5' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.7' # Use Redis adapter to run Action Cable in production # gem 'redis', '~> 4.0' # Use Active Model has_secure_password # gem 'bcrypt', '~> 3.1.7' # Use Active Storage variant # gem 'image_processing', '~> 1.2' # Reduces boot times through caching; required in config/boot.rb gem 'bootsnap', '>= 1.4.4', require: false group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] gem 'sqlite3', '~> 1.4' end group :development do # Access an interactive console on exception pages or by calling 'console' anywhere in the code. gem 'web-console', '>= 4.1.0' # Display performance information such as SQL time and flame graphs for each request in your browser. # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md gem 'rack-mini-profiler', '~> 2.0' gem 'listen', '~> 3.3' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' end group :test do # Adds support for Capybara system testing and selenium driver gem 'capybara', '>= 3.26' gem 'selenium-webdriver' # Easy installation and use of web drivers to run system tests with browsers gem 'webdrivers' end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
試したこと
調べたところ、springを停止すればエラーが止まったとの記事を発見。
% sudo gem install spring
↓
% spring stop
でspringを停止。
しかし変わらず。
といった現状です。
どこが誤っているかアドバイスを頂けると幸いです。
補足情報(FW/ツールのバージョンなど)
M1 macbook使用
% bundle lock --add-plataform x86_64-linux ```を実行しherokuに対応
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2021/09/12 12:41