質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

MySQL

MySQL(マイエスキューエル)は、TCX DataKonsultAB社などが開発するRDBMS(リレーショナルデータベースの管理システム)です。世界で最も人気の高いシステムで、オープンソースで開発されています。MySQLデータベースサーバは、高速性と信頼性があり、Linux、UNIX、Windowsなどの複数のプラットフォームで動作することができます。

mysqli

MySQLiはPHP5より導入されているデータベース用のドライバです。MySQL 4.1.3以降の新しい機能の利点をまとめています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

1回答

1307閲覧

Rails - rails s後にLoadErrorが発生します

takuya861

総合スコア14

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

MySQL

MySQL(マイエスキューエル)は、TCX DataKonsultAB社などが開発するRDBMS(リレーショナルデータベースの管理システム)です。世界で最も人気の高いシステムで、オープンソースで開発されています。MySQLデータベースサーバは、高速性と信頼性があり、Linux、UNIX、Windowsなどの複数のプラットフォームで動作することができます。

mysqli

MySQLiはPHP5より導入されているデータベース用のドライバです。MySQL 4.1.3以降の新しい機能の利点をまとめています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2020/07/07 15:18

rails s後、localgost:3000にアクセスするとLoadErrorが発生します。
色々調べてみたのですが、解決せずどなたかご教示いただけると幸いです。

やったこと
・gemの再インストール
・bundle update

エラー分は以下となります。

2020-07-07 23:51:30 +0900: Rack app error handling request { GET / } #<LoadError: Error loading the 'mysql2' Active Record adapter. Missing a gem it depends on? cannot load such file -- /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/mysql/column.rb> /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `block in require' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:257:in `load_dependency' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `require' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:5:in `<main>' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `block in require' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:257:in `load_dependency' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `require' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/mysql2_adapter.rb:3:in `<main>' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `block in require' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:257:in `load_dependency' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `require' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/connection_specification.rb:191:in `spec' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:975:in `establish_connection' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/connection_handling.rb:60:in `establish_connection' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/railtie.rb:136:in `block (2 levels) in <class:Railtie>' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/lazy_load_hooks.rb:51:in `each' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/base.rb:328:in `<module:ActiveRecord>' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/base.rb:27:in `<main>' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `block in require' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:257:in `load_dependency' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `require' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.2/lib/active_record/query_cache.rb:29:in `run' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/execution_wrapper.rb:27:in `before' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:426:in `block in make_lambda' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:198:in `block (2 levels) in halting' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:606:in `block (2 levels) in default_terminator' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:605:in `catch' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:605:in `block in default_terminator' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:199:in `block in halting' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:513:in `block in invoke_before' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:513:in `each' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:513:in `invoke_before' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:131:in `run_callbacks' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/execution_wrapper.rb:110:in `run!' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/execution_wrapper.rb:72:in `block in run!' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/execution_wrapper.rb:69:in `tap' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.2/lib/active_support/execution_wrapper.rb:69:in `run!' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.4.2/lib/action_dispatch/middleware/executor.rb:12:in `call' /Users/ユーザ名/Taskun/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.4.2/lib/action_dispatch/middleware/static.rb:127:in `call'

よろしくお願い致します。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

technocore

2020/07/07 22:38

MySQLが正しくインストールできて動作していることを確認してください。 rails s以前に、railsアプリのインストール(rails new)がエラーなく実行できたか確認してください。
siruku6

2020/07/07 23:55

$ which mysql $ mysql --version を実行してみて何が表示されるか、ですね~
takuya861

2020/07/08 12:22 編集

technocoreさん mysql --versionの結果は【mysql Ver 14.14 Distrib 5.7.29, for osx10.15 (x86_64) using EditLine wrapper】 rails newはmysql2でエラーとなりました。 下記エラー文です。 An error occurred while installing mysql2 (0.5.3), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.5.3' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: mysql2 run bundle binstubs bundler Could not find gem 'rails (~> 6.0.3)' in any of the gem sources listed in your Gemfile. run bundle exec spring binstub --all Could not find gem 'rails (~> 6.0.3)' in any of the gem sources listed in your Gemfile. Run `bundle install` to install missing gems. rails webpacker:install Could not find gem 'rails (~> 6.0.3)' in any of the gem sources listed in your Gemfile. Run `bundle install` to install missing gems. gem install mysql2 -v '0.5.3' --source 'https://rubygems.org/'をしましたがこれもエラーがでました。 Failed to load /Users/kawasetakuya/.gemrc because it doesn't contain valid YAML hash Building native extensions. This could take a while... ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. current directory: /Users/kawasetakuya/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/mysql2-0.5.3/ext/mysql2 /Users/kawasetakuya/.rbenv/versions/2.7.0/bin/ruby -I /Users/kawasetakuya/.rbenv/versions/2.7.0/lib/ruby/2.7.0 -r ./siteconf20200708-57566-1hw8z5g.rb extconf.rb checking for rb_absint_size()... yes checking for rb_absint_singlebit_p()... yes checking for rb_wait_for_single_fd()... yes ----- Using mysql_config at /usr/local/opt/mysql@5.7/bin/mysql_config ----- checking for mysql.h... yes checking for errmsg.h... yes checking for SSL_MODE_DISABLED in mysql.h... yes checking for SSL_MODE_PREFERRED in mysql.h... yes checking for SSL_MODE_REQUIRED in mysql.h... yes checking for SSL_MODE_VERIFY_CA in mysql.h... yes checking for SSL_MODE_VERIFY_IDENTITY in mysql.h... yes checking for MYSQL.net.vio in mysql.h... yes checking for MYSQL.net.pvio in mysql.h... no checking for MYSQL_ENABLE_CLEARTEXT_PLUGIN in mysql.h... yes checking for SERVER_QUERY_NO_GOOD_INDEX_USED in mysql.h... yes checking for SERVER_QUERY_NO_INDEX_USED in mysql.h... yes checking for SERVER_QUERY_WAS_SLOW in mysql.h... yes checking for MYSQL_OPTION_MULTI_STATEMENTS_ON in mysql.h... yes checking for MYSQL_OPTION_MULTI_STATEMENTS_OFF in mysql.h... yes checking for my_bool in mysql.h... yes ----- Don't know how to set rpath on your system, if MySQL libraries are not in path mysql2 may not load ----- ----- Setting libpath to /usr/local/opt/mysql@5.7/lib ----- creating Makefile current directory: /Users/kawasetakuya/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/mysql2-0.5.3/ext/mysql2 make "DESTDIR=" clean current directory: /Users/kawasetakuya/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/mysql2-0.5.3/ext/mysql2 make "DESTDIR=" compiling client.c client.c:787:14: warning: incompatible pointer types passing 'VALUE (void *)' (aka 'unsigned long (void *)') to parameter of type 'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-pointer-types] rb_rescue2(do_send_query, (VALUE)&args, disconnect_and_raise, self, rb_eException, (VALUE)0); ^~~~~~~~~~~~~ /Users/kawasetakuya/.rbenv/versions/2.7.0/include/ruby-2.7.0/ruby/ruby.h:1988:25: note: passing argument to parameter here VALUE rb_rescue2(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE,...); ^ client.c:795:16: warning: incompatible pointer types passing 'VALUE (void *)' (aka 'unsigned long (void *)') to parameter of type 'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-pointer-types] rb_rescue2(do_query, (VALUE)&async_args, disconnect_and_raise, self, rb_eException, (VALUE)0); ^~~~~~~~ /Users/kawasetakuya/.rbenv/versions/2.7.0/include/ruby-2.7.0/ruby/ruby.h:1988:25: note: passing argument to parameter here VALUE rb_rescue2(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE,...); ^ 2 warnings generated. compiling infile.c compiling mysql2_ext.c compiling result.c compiling statement.c linking shared-object mysql2/mysql2.bundle ld: library not found for -lssl clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [mysql2.bundle] Error 1 make failed, exit code 2 Gem files will remain installed in /Users/kawasetakuya/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/mysql2-0.5.3 for inspection. Results logged to /Users/kawasetakuya/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/extensions/x86_64-darwin-19/2.7.0/mysql2-0.5.3/gem_make.out ながながとエラー文を申し訳ありません。 どこが必要なのかもわからず…
takuya861

2020/07/08 12:21

siruku6さん $which mysql → /usr/local/opt/mysql@5.7/bin/mysql $mysql --version → mysql Ver 14.14 Distrib 5.7.29, for osx10.15 (x86_64) using EditLine wrapper 上記のようになります。 おかしい箇所はありますでしょうか?
guest

回答1

0

自己解決

解決しました。ありがとうございました。

投稿2020/09/27 01:24

takuya861

総合スコア14

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問