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

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

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

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

AWS(Amazon Web Services)

Amazon Web Services (AWS)は、仮想空間を機軸とした、クラスター状のコンピュータ・ネットワーク・データベース・ストーレッジ・サポートツールをAWSというインフラから提供する商用サービスです。

Q&A

解決済

1回答

1349閲覧

AWS  bundlerをインストールしたい

ken1203

総合スコア24

Ruby on Rails 6

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

AWS(Amazon Web Services)

Amazon Web Services (AWS)は、仮想空間を機軸とした、クラスター状のコンピュータ・ネットワーク・データベース・ストーレッジ・サポートツールをAWSというインフラから提供する商用サービスです。

0グッド

0クリップ

投稿2020/11/22 04:31

編集2020/11/22 04:51

前提・実現したいこと

前提
Ruby on Rails6にてアプリを作成
AWS インスタンス作成
EC2にログイン
EC2インスタンス内の環境構築が完了
GitHubクローン完了

実現したいこと
本番環境でgemを管理するためのbundlerをインストールしたい

発生している問題・エラーメッセージ

ターミナル Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
ターミナル An error occurred while installing mysql2 (0.4.10), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.4.10' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: mysql2

該当するソースコード

ターミナル [ec2-user@ip-********** Dr_nishi]$ gem install bundler -v 2.1.4 Fetching: bundler-2.1.4.gem (100%) Successfully installed bundler-2.1.4 Parsing documentation for bundler-2.1.4 Installing ri documentation for bundler-2.1.4 Done installing documentation for bundler after 4 seconds 1 gem installed [ec2-user@ip-*********** Dr_nishi]$ bundle install The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`. Fetching gem metadata from https://rubygems.org/............ Fetching rake 13.0.1 Installing rake 13.0.1 Fetching concurrent-ruby 1.1.7 Installing concurrent-ruby 1.1.7 Fetching i18n 1.8.5 Installing i18n 1.8.5 Fetching minitest 5.14.2 Installing minitest 5.14.2 Fetching thread_safe 0.3.6 Installing thread_safe 0.3.6 Fetching tzinfo 1.2.8 Installing tzinfo 1.2.8 Fetching zeitwerk 2.4.1 Installing zeitwerk 2.4.1 Fetching activesupport 6.0.3.4 Installing activesupport 6.0.3.4 Fetching builder 3.2.4 Installing builder 3.2.4 Fetching erubi 1.9.0 Installing erubi 1.9.0 Fetching mini_portile2 2.4.0 Installing mini_portile2 2.4.0 Fetching nokogiri 1.10.10 Installing nokogiri 1.10.10 with native extensions Fetching rails-dom-testing 2.0.3 Installing rails-dom-testing 2.0.3 Fetching crass 1.0.6 Installing crass 1.0.6 Fetching loofah 2.7.0 Installing loofah 2.7.0 Fetching rails-html-sanitizer 1.3.0 Installing rails-html-sanitizer 1.3.0 Fetching actionview 6.0.3.4 Installing actionview 6.0.3.4 Fetching rack 2.2.3 Installing rack 2.2.3 Fetching rack-test 1.1.0 Installing rack-test 1.1.0 Fetching actionpack 6.0.3.4 Installing actionpack 6.0.3.4 Fetching nio4r 2.5.4 Installing nio4r 2.5.4 with native extensions Fetching websocket-extensions 0.1.5 Installing websocket-extensions 0.1.5 Fetching websocket-driver 0.7.3 Installing websocket-driver 0.7.3 with native extensions Fetching actioncable 6.0.3.4 Installing actioncable 6.0.3.4 Fetching globalid 0.4.2 Installing globalid 0.4.2 Fetching activejob 6.0.3.4 Installing activejob 6.0.3.4 Fetching activemodel 6.0.3.4 Installing activemodel 6.0.3.4 Fetching activerecord 6.0.3.4 Installing activerecord 6.0.3.4 Fetching mimemagic 0.3.5 Installing mimemagic 0.3.5 Fetching marcel 0.3.3 Installing marcel 0.3.3 Fetching activestorage 6.0.3.4 Installing activestorage 6.0.3.4 Fetching mini_mime 1.0.2 Installing mini_mime 1.0.2 Fetching mail 2.7.1 Installing mail 2.7.1 Fetching actionmailbox 6.0.3.4 Installing actionmailbox 6.0.3.4 Fetching actionmailer 6.0.3.4 Installing actionmailer 6.0.3.4 Fetching actiontext 6.0.3.4 Installing actiontext 6.0.3.4 Fetching public_suffix 4.0.6 Installing public_suffix 4.0.6 Fetching addressable 2.7.0 Installing addressable 2.7.0 Fetching bcrypt 3.1.16 Installing bcrypt 3.1.16 with native extensions Fetching bindex 0.8.1 Installing bindex 0.8.1 with native extensions Fetching msgpack 1.3.3 Installing msgpack 1.3.3 with native extensions Fetching bootsnap 1.5.0 Installing bootsnap 1.5.0 with native extensions Fetching thor 1.0.1 Installing thor 1.0.1 Fetching bourbon 7.0.0 Installing bourbon 7.0.0 Using bundler 2.1.4 Fetching byebug 11.1.3 Installing byebug 11.1.3 with native extensions Fetching regexp_parser 1.8.2 Installing regexp_parser 1.8.2 Fetching xpath 3.2.0 Installing xpath 3.2.0 Fetching capybara 3.33.0 Installing capybara 3.33.0 Fetching childprocess 3.0.0 Installing childprocess 3.0.0 Fetching orm_adapter 0.5.0 Installing orm_adapter 0.5.0 Fetching method_source 1.0.0 Installing method_source 1.0.0 Fetching railties 6.0.3.4 Installing railties 6.0.3.4 Fetching responders 3.0.1 Installing responders 3.0.1 Fetching warden 1.2.9 Installing warden 1.2.9 Fetching devise 4.7.3 Installing devise 4.7.3 Fetching erubis 2.7.0 Installing erubis 2.7.0 Fetching ffi 1.13.1 Installing ffi 1.13.1 with native extensions Fetching sassc 2.4.0 Installing sassc 2.4.0 with native extensions Fetching font-awesome-sass 5.15.1 Installing font-awesome-sass 5.15.1 Fetching temple 0.8.2 Installing temple 0.8.2 Fetching tilt 2.0.10 Installing tilt 2.0.10 Fetching haml 5.2.0 Installing haml 5.2.0 Fetching sexp_processor 4.15.1 Installing sexp_processor 4.15.1 Fetching ruby_parser 3.15.0 Installing ruby_parser 3.15.0 Fetching html2haml 2.2.0 Installing html2haml 2.2.0 Fetching haml-rails 2.0.1 Installing haml-rails 2.0.1 Fetching mini_magick 4.11.0 Installing mini_magick 4.11.0 Fetching ruby-vips 2.0.17 Installing ruby-vips 2.0.17 Fetching image_processing 1.12.1 Installing image_processing 1.12.1 Fetching jbuilder 2.10.1 Installing jbuilder 2.10.1 Fetching jquery-rails 4.4.0 Installing jquery-rails 4.4.0 Fetching kgio 2.11.3 Installing kgio 2.11.3 with native extensions Fetching rb-fsevent 0.10.4 Installing rb-fsevent 0.10.4 Fetching rb-inotify 0.10.1 Installing rb-inotify 0.10.1 Fetching listen 3.2.1 Installing listen 3.2.1 Fetching mysql2 0.4.10 Installing mysql2 0.4.10 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/mysql2-0.4.10/ext/mysql2 /home/ec2-user/.rbenv/versions/2.5.1/bin/ruby -r ./siteconf20201122-25816-mmmq6h.rb extconf.rb checking for rb_absint_size()... yes checking for rb_absint_singlebit_p()... yes checking for ruby/thread.h... yes checking for rb_thread_call_without_gvl() in ruby/thread.h... yes checking for rb_thread_blocking_region()... no checking for rb_wait_for_single_fd()... yes checking for rb_hash_dup()... yes checking for rb_intern3()... yes checking for rb_big_cmp()... yes checking for mysql_query() in -lmysqlclient... no ----- mysql client is missing. You may need to 'apt-get install libmysqlclient-dev' or 'yum install mysql-devel', and try again. ----- *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/home/ec2-user/.rbenv/versions/2.5.1/bin/$(RUBY_BASE_NAME) --with-mysql-dir --without-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib --with-mysql-config --without-mysql-config --with-mysql-dir --without-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib --with-mysqlclientlib --without-mysqlclientlib To see why this extension failed to compile, please check the mkmf.log which can be found here: /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0/mysql2-0.4.10/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/mysql2-0.4.10 for inspection. Results logged to /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0/mysql2-0.4.10/gem_make.out An error occurred while installing mysql2 (0.4.10), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.4.10' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: mysql2
gemfile.lock RUBY VERSION ruby 2.5.1p57 BUNDLED WITH 2.1.4

試したこと(仮説)

エラー内容で検索行い以下のリンクを参照にしました。
リンク内容
リンク内容
参照しましたが解決策がわかりませんでした。

補足

初心者で言葉足らずで申し訳ありませんがご教示頂けたらと思い質問させて頂きました。
宜しくお願い致します。

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

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

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

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

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

guest

回答1

0

ベストアンサー

rubyのバージョンは2.5.1でしょうか?
古すぎてまもなくサポート終了なので、たとえば2.5.8などにアップデートされた方がよろしいかと。

(Rubyのサイトより)

WARNING: ruby-2.5.1 is nearing its end of life.
It only receives critical security updates, no bug fixes.

また、質問文ではgem mysql2のコンパイルに失敗しています。

Installing mysql2 0.4.10 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

下記メッセージを参考に、mysqlクライアントや開発用ライブラリなどのパッケージをインストールしてみてください。
パッケージ名はOS毎に違いますので、自分で調べてください。

ysql client is missing. You may need to 'apt-get install libmysqlclient-dev' or
'yum install mysql-devel', and try again.

投稿2020/11/22 04:56

technocore

総合スコア7247

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

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

ken1203

2020/11/22 05:48

返信ありがとうございます! $ sudo yum install mysql-develのあと$ bundle installがうまくできました!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.46%

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

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

質問する

関連した質問