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

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

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

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

Ruby on Rails

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

AWS(Amazon Web Services)

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

Q&A

解決済

2回答

1278閲覧

AWSデプロイでrake db:create RAILS_ENV=productionが実行できない。

amby

総合スコア40

Ruby

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

Ruby on Rails

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

AWS(Amazon Web Services)

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

0グッド

0クリップ

投稿2020/09/13 09:41

実現したいことと起きていること

下記のサイトを参考にAWSへのデプロイを試みています。「MySQLの設定」のところでつまづいています

https://qiita.com/naoki_mochizuki/items/5a1757d222806cbe0cd1

下記のrake db:create RAILS_ENV=productionを実行するとエラーがでます。
イメージ説明

エラー内容

Could not find mysql2-0.5.3 in any of the sources Run `bundle install` to install missing gems. コード

試したこと1

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/............
Using rake 13.0.1
Using concurrent-ruby 1.1.6
Using i18n 1.8.5
Using minitest 5.14.1
Using thread_safe 0.3.6
Using tzinfo 1.2.7
Using activesupport 5.2.4.3
Using builder 3.2.4
Using erubi 1.9.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.10
Using rails-dom-testing 2.0.3
Using crass 1.0.6
Using loofah 2.6.0
Using rails-html-sanitizer 1.3.0
Using actionview 5.2.4.3
Using rack 2.2.3
Using rack-test 1.1.0
Using actionpack 5.2.4.3
Using nio4r 2.5.2
Using websocket-extensions 0.1.5
Using websocket-driver 0.7.3
Using actioncable 5.2.4.3
Using globalid 0.4.2
Using activejob 5.2.4.3
Using mini_mime 1.0.2
Using mail 2.7.1
Using actionmailer 5.2.4.3
Using activemodel 5.2.4.3
Using arel 9.0.0
Using activerecord 5.2.4.3
Using mimemagic 0.3.5
Using marcel 0.3.3
Using activestorage 5.2.4.3
Using public_suffix 4.0.5
Using addressable 2.7.0
Using io-like 0.3.1
Using archive-zip 0.12.0
Using aws_cf_signer 0.1.3
Using bcrypt 3.1.15
Using bindex 0.8.1
Using msgpack 1.3.3
Using bootsnap 1.4.7
Using bundler 2.1.4
Using byebug 11.1.3
Using regexp_parser 1.7.1
Using xpath 3.2.0
Using capybara 3.33.0
Using mime-types-data 3.2020.0512
Using mime-types 3.3.1
Using carrierwave 1.3.1
Using childprocess 3.0.0
Using chromedriver-helper 2.1.1
Using http-accept 1.7.0
Using unf_ext 0.0.7.7
Using unf 0.1.4
Using domain_name 0.5.20190701
Using http-cookie 1.0.3
Using netrc 0.11.0
Using rest-client 2.1.0
Using cloudinary 1.16.1
Using coderay 1.1.3
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using coffee-script 2.4.1
Using method_source 1.0.0
Using thor 1.0.1
Using railties 5.2.4.3
Using coffee-rails 4.2.2
Using diff-lcs 1.4.4
Using factory_bot 4.11.1
Using factory_bot_rails 4.11.1
Using ffi 1.13.1
Using geocoder 1.6.3
Using jbuilder 2.10.0
Using jquery-rails 4.4.0
Using kaminari-core 1.2.1
Using kaminari-actionview 1.2.1
Using kaminari-activerecord 1.2.1
Using kaminari 1.2.1
Using kgio 2.11.3
Using rb-fsevent 0.10.4
Using rb-inotify 0.10.1
Using ruby_dep 1.5.0
Using listen 3.1.5
Using mini_magick 4.10.1
Fetching mysql2 0.5.3
Installing mysql2 0.5.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/home/taishi/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/mysql2-0.5.3/ext/mysql2
/home/taishi/.rbenv/versions/2.7.1/bin/ruby -I
/home/taishi/.rbenv/versions/2.7.1/lib/ruby/2.7.0 -r
./siteconf20200913-6915-1pkxryk.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for rb_wait_for_single_fd()... yes
*** 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/taishi/.rbenv/versions/2.7.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-mysqlclient-dir
--without-mysqlclient-dir
--with-mysqlclient-include
--without-mysqlclient-include=${mysqlclient-dir}/include
--with-mysqlclient-lib
--without-mysqlclient-lib=${mysqlclient-dir}/lib
--with-mysqlclientlib
--without-mysqlclientlib
/home/taishi/.rbenv/versions/2.7.1/lib/ruby/2.7.0/mkmf.rb:1050:in block in find_library': undefined method split' for nil:NilClass (NoMethodError)
from /home/taishi/.rbenv/versions/2.7.1/lib/ruby/2.7.0/mkmf.rb:1050:in
collect' from /home/taishi/.rbenv/versions/2.7.1/lib/ruby/2.7.0/mkmf.rb:1050:in find_library'
from extconf.rb:87:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

/home/taishi/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/mysql2-0.5.3/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
/home/taishi/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/mysql2-0.5.3 for
inspection.
Results logged to
/home/taishi/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/mysql2-0.5.3/gem_make.out

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

コード

### 試したこと2 brew info opensslを実行してみましたが「-bash: brew: コマンドが見つかりません」と出てしまいます。 下記の記事を参考にしました。 https://qiita.com/fukuda_fu/items/463a39406ce713396403 ### 試したこと3 https://brew.sh/index_ja.htmlのサイトから下記を実行しインストール。 「/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"」 このように出ましたが、結局「-bash: brew: コマンドが見つかりません」と出てしまう状態は変わりません。 ```==> This script will install: /home/linuxbrew/.linuxbrew/bin/brew /home/linuxbrew/.linuxbrew/share/doc/homebrew /home/linuxbrew/.linuxbrew/share/man/man1/brew.1 /home/linuxbrew/.linuxbrew/share/zsh/site-functions/_brew /home/linuxbrew/.linuxbrew/etc/bash_completion.d/brew /home/linuxbrew/.linuxbrew/Homebrew ==> The following existing directories will be made writable by user only: /home/linuxbrew/.linuxbrew/share/zsh /home/linuxbrew/.linuxbrew/share/zsh/site-functions Press RETURN to continue or any other key to abort [sudo] taishi のパスワード: ==> /usr/bin/sudo /bin/chmod u+rwx /home/linuxbrew/.linuxbrew/share/zsh /home/linuxbrew/.linuxbrew/share/zsh/site-functions ==> /usr/bin/sudo /bin/chmod 755 /home/linuxbrew/.linuxbrew/share/zsh /home/linuxbrew/.linuxbrew/share/zsh/site-functions ==> Downloading and installing Homebrew... HEAD is now at 484c2b4fa Merge pull request #8715 from Homebrew/tapioca-update Already up-to-date. Warning: /home/linuxbrew/.linuxbrew/bin is not in your PATH. ==> Installation successful! ==> Homebrew has enabled anonymous aggregate formulae and cask analytics. Read the analytics documentation (and how to opt-out) here: https://docs.brew.sh/Analytics No analytics data has been sent yet (or will be during this `install` run). ==> Homebrew is run entirely by unpaid volunteers. Please consider donating: https://github.com/Homebrew/brew#donations ==> Next steps: - Run `brew help` to get started - Further documentation: https://docs.brew.sh - Install the Homebrew dependencies if you have sudo access: sudo yum groupinstall 'Development Tools' See https://docs.brew.sh/linux for more information - Add Homebrew to your PATH in /home/taishi/.bash_profile: echo 'eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)' >> /home/taishi/.bash_profile eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) - We recommend that you install GCC: brew install gcc コード

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

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

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

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

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

guest

回答2

0

この記事も参考にしました。
https://qiita.com/showwin/items/e069bbba9c87a6c7d91c

投稿2020/09/14 11:41

amby

総合スコア40

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

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

0

ベストアンサー

Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers.

とあるように、多分足りないものがあります。それがなになのかは
Check the mkmf.log file for more details.

とあるようにmkmf.log を確認してください。
/home/taishi/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/mysql2-0.5.3/mkmf.log

にあります。

AWS mysql2 で検索すると良いでしょう。

投稿2020/09/13 20:54

winterboum

総合スコア23329

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

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

amby

2020/09/14 11:41

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問