0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

mimemagicのインストール エラーと格闘した軌跡

Posted at

mimemagicをインストールしたい

ここ5時間くらいmimemagicのインストールに悩まされています。(泣)
未来の自分に向けて解決策を備忘録として残しておきたいと思います。

mimemagic との戦い

一通りgemgileやらなんやらを用意して、いざ以下のコードを書いたところ、
subaru$ docker-compose run web rails new . --force --database=mysql

全てはこのエラー文から始まった。

An error occurred while installing mimemagic (0.3.10), and Bundler cannot continue.
Make sure that `gem install mimemagic -v '0.3.10' --source 'https://rubygems.org/'` succeeds before
bundling.

gem meme
https://qiita.com/friendtree16/items/62c7ec366c107c4b1313

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.

$ gem install mysql2 -v '0.5.2' --source 'https://rubygems.org/' -- --with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib
Fetching mysql2-0.5.2.gem
Building native extensions with: '--with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib'
This could take a while...
Successfully installed mysql2-0.5.2
Parsing documentation for mysql2-0.5.2
Installing ri documentation for mysql2-0.5.2
Done installing documentation for mysql2 after 0 seconds
1 gem installed
subaru$ brew install shared-mime-info
Updating Homebrew..
subaru$ brew info openssl
subaru$ bundle config --local build.mysql2 "--with-cppflags=-I/usr/local/opt/openssl/include"
subaru$ bundle config --local build.mysql2 "--with-ldflags=-L/usr/local/opt/openssl/lib"
subaru$  bundle install
.
.
.
Bundle complete! 26 Gemfile dependencies, 91 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
subaru$ docker-compose run web rails new . --force --database=mysql

そして以下のコードを記入したら、こんなエラー文が出た。

You must use Bundler 2 or greater with this lockfile.
ERROR: Service 'web' failed to build : The command '/bin/sh -c bundle install' returned a non-zero code: 20

この記事を参考にして、
https://qiita.com/___xxx_/items/8b62633b59d7d72e6719

subaru$ rm Gemfile.lock
subaru$ rm -rf vendor/bundle
subaru$ gem install bundler -v '2.2.17'

をしたところ治った!どうやらBundlerのバージョンとローカルのバージョンが異なることが原因だったらしい。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?