最近の勉強で学んだ事を、ノート代わりにまとめていきます。
主に自分の学習の流れを振り返りで残す形なので色々、省いてます。
Webエンジニアの諸先輩方からアドバイスやご指摘を頂けたらありがたいです!
bundle installを実行した際に起きた出来事
このエラーは、ごくたまに遭遇するのですが、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 'puma (~> 3.11)' in any of the gem sources listed in your Gemfile.
run bundle exec spring binstub --all
bundler: command not found: spring
Install missing gem executables with `bundle install
エラーで言われている通りに、以下のコマンドを実行したのですが...
$ gem install mysql2 -v '0.5.3' --source 'https://rubygems.org/'
変わらず同じエラーが...
解決策を調べて試していた所、そもそもちゃんとmysqlが動かないことを確認
$ mysql.server start
Starting MySQL
.. ERROR! The server quit without updating PID file (/usr/local/var/mysql/XXXXXXXX.local.pid).
まずは、mysqlをスタートさせようとしたがこちらもエラーが直らないので
この記事を参考に再インストール!
記事の通りに /usr/local/var/mysql も削除し
$ sudo rm -rf /usr/local/var/mysql
$ brew uninstall mysql
$ brew install mysql
で、試してみると…
mysql.server start
Starting MySQL
SUCCESS!
成功し、試しにbundle install もした所こちらも成功した!
そもそも、ちゃんとsqlが動いてなかったのが原因かもしれないです。