前提・実現したいこと
Ruby on Railsで新たなプロジェクトを作っています。
rails 5.2.4.1 new (project名) -d mysqlし、bundle installしたところで、rails db:createした際に、以下のエラーメッセージが発生しました。
おそらく、gemの読み込みの段階で、変なところにパスを通してしまっている事か、mysqlの読み込みエラーかと思うのですが、自己解決できずに質問させていただきます。
初めて、こちらのサイトを使いますので必要な情報は全て載せているつもりですが、足りないものあれば教えてください。
何卒、よろしくお願いします。
発生している問題・エラーメッセージ
rails aborted! LoadError: cannot load such file -- mysql2/mysql2 /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:89:in `register' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:40:in `rescue in require' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:26:in `require' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:291:in `block in require' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:257:in `load_dependency' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:291:in `require' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' /Users/(ユーザー名)/(project名)/config/application.rb:7:in `<top (required)>' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require' /Users/(ユーザー名)a/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:291:in `block in require' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:257:in `load_dependency' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:291:in `require' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:48:in `require_relative' /Users/(ユーザー名)/(project名)/Rakefile:4:in `<top (required)>' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load' /Users/(ユーザー名)a/(project名)/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:285:in `block in load' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:257:in `load_dependency' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:285:in `load' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/railties-5.2.4.1/lib/rails/commands/rake/rake_command.rb:22:in `block in perform' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/railties-5.2.4.1/lib/rails/commands/rake/rake_command.rb:20:in `perform' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/railties-5.2.4.1/lib/rails/command.rb:48:in `invoke' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/railties-5.2.4.1/lib/rails/commands.rb:18:in `<top (required)>' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:291:in `block in require' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:257:in `load_dependency' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:291:in `require' /Users/(ユーザー名)/(project名)/bin/rails:9:in `<top (required)>' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/spring-2.1.0/lib/spring/client.rb:30:in `run' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/spring-2.1.0/bin/spring:49:in `<top (required)>' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load' /Users/(ユーザー名)/(project名)/vendor/bundle/ruby/2.5.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>' /Users/(ユーザー名)/(project名)/bin/spring:15:in `<top (required)>' bin/rails:3:in `load' bin/rails:3:in `<main>' Caused by: Bootsnap::LoadPathCache::FallbackScan:
試したこと
- HomeBrewのアップデート
- railsプロジェクトの再度作り直し、
- gemファイルの見直し
ここまで、個人的に行ってギブアップしました。
以下からが、ググって試したページです。
- Catalinaにアップデート後 bundle installに失敗に従い、コマンドラインの確認とインストール
- cannot load such file — mysql2/mysql2 というエラーが発生した。に従い、gemファイルのパスの確認、結果、プロジェクトディレクトリないにvendor/bundleが生成され、そのファイルの中にBUNDLE_PATH: "vendor/bundle"と記載されていました。
- Ruby on RailsでのMySQLのエラー解決、データベース作成~テーブル作成までの覚書き
を参考にしましたが、解決せず、質問させていただきます。
補足情報(FW/ツールのバージョンなど)
MacOS Catalina 10.15.2
Rails 5.2.4.1
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin18]
mysql Server version: 5.7.29 Homebrew
Homebrew 2.2.3
あなたの回答
tips
プレビュー