@kazchin

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

An error occurred while installing mysql2 (0.5.5), and Bundler cannot continue. In Gemfile: mysql2

解決したいこと

 Docker 上で Ruby 、 Rails 、 Mysql を作ろうとすると下記エラーで
 Rails を起動できません。

環境)
MacBook Air:Apple M1:Ventura13.3.1
Ruby 3.1.2
Rails 7.0.4.3
MySQL 5.7 ?

発生している問題・エラー

% docker-compose up -d
[+] Running 2/2
✔ Container ruby-lecture-db-1 Running 0.0s
✔ Container ruby-lecture-web-1 Started 0.2s
とDockerのコンテナは動作しているみたいです。

% docker-compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
ruby-lecture-db-1 mysql:5.7 "docker-entrypoint.s…" db 4 hours ago Up 4 hours 3306/tcp, 33060/tcp

と動作はしているみたいですが・・・

% docker-compose run web bundle exec rake db:creae
[+] Running 1/0
✔ Container ruby-lecture-db-1 Running 0.0s
Could not find gem 'sprockets-rails' in locally installed gems.
Run bundle install to install missing gems.

と怒られます。

言われた通り、'bundle install'すると、

An error occurred while installing mysql2 (0.5.5), and Bundler cannot continue.

In Gemfile:
mysql2

と怒られます。

ググりまくって解決策を探しましたが見つかりません。
初心者なのでHELPしてください。

あと、Rails が動いているLocalポート番号がわかりません・・・

よろしくお願いします〜

0 likes

Your answer might help someone💌