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

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

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

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

Ruby on Rails

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

Q&A

解決済

1回答

576閲覧

bundle installが通らずエラーがでます。

hazu

総合スコア33

Ruby

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

Ruby on Rails

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

1グッド

0クリップ

投稿2019/02/05 06:29

ruby on rails で bundle install をした結果このようなエラーが表示されました。

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

どのようにすれば解決できますか?

エラーの全て

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 gem metadata from https://rubygems.org/. Resolving dependencies... Using rake 12.3.2 Using concurrent-ruby 1.1.4 Using i18n 1.5.3 Using minitest 5.11.3 Using thread_safe 0.3.6 Using tzinfo 1.2.5 Using activesupport 5.0.7.1 Using builder 3.2.3 Using erubis 2.7.0 Using mini_portile2 2.4.0 Using nokogiri 1.10.1 Using rails-dom-testing 2.0.3 Using crass 1.0.4 Using loofah 2.2.3 Using rails-html-sanitizer 1.0.4 Using actionview 5.0.7.1 Using rack 2.0.6 Using rack-test 0.6.3 Using actionpack 5.0.7.1 Using nio4r 2.3.1 Using websocket-extensions 0.1.3 Using websocket-driver 0.6.5 Using actioncable 5.0.7.1 Using globalid 0.4.2 Using activejob 5.0.7.1 Using mini_mime 1.0.1 Using mail 2.7.1 Using actionmailer 5.0.7.1 Using activemodel 5.0.7.1 Using arel 7.1.4 Using activerecord 5.0.7.1 Using bindex 0.5.0 Using bundler 1.16.6 Using byebug 10.0.2 Using coffee-script-source 1.12.2 Using execjs 2.7.0 Using coffee-script 2.4.1 Using method_source 0.9.2 Using thor 0.20.3 Using railties 5.0.7.1 Using coffee-rails 4.2.2 Using ffi 1.10.0 Using multi_json 1.13.1 Using jbuilder 2.8.0 Using jquery-rails 4.3.3 Using rb-fsevent 0.10.3 Using rb-inotify 0.10.0 Using listen 3.0.8 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/.rvm/gems/ruby-2.5.3/gems/mysql2-0.4.10/ext/mysql2 /home/ec2-user/.rvm/rubies/ruby-2.5.3/bin/ruby -r ./siteconf20190205-8430-9sjihd.rb extconf.rb --with-opt-lib=/usr/local/opt/openssl/lib --with-opt-include=-I/usr/local/opt/openssl/include 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 ----- Using mysql_config at /usr/bin/mysql_config ----- checking for mysql.h... no checking for mysql/mysql.h... no ----- mysql.h 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=${opt-dir}/include --with-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/home/ec2-user/.rvm/rubies/ruby-2.5.3/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 To see why this extension failed to compile, please check the mkmf.log which can be found here: /home/ec2-user/.rvm/gems/ruby-2.5.3/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/.rvm/gems/ruby-2.5.3/gems/mysql2-0.4.10 for inspection. Results logged to /home/ec2-user/.rvm/gems/ruby-2.5.3/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はこれです。

Gemfile

1source 'https://rubygems.org' 2 3git_source(:github) do |repo_name| 4 repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") 5 "https://github.com/#{repo_name}.git" 6end 7 8 9# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 10gem 'rails', '~> 5.0.6' 11# Use mysql as the database for Active Record 12gem 'mysql2', '>= 0.3.18', '< 0.5' 13# Use Puma as the app server 14gem 'puma', '~> 3.0' 15# Use SCSS for stylesheets 16gem 'sass-rails', '~> 5.0' 17# Use Uglifier as compressor for JavaScript assets 18gem 'uglifier', '>= 1.3.0' 19# Use CoffeeScript for .coffee assets and views 20gem 'coffee-rails', '~> 4.2' 21# See https://github.com/rails/execjs#readme for more supported runtimes 22# gem 'therubyracer', platforms: :ruby 23 24# Use jquery as the JavaScript library 25gem 'jquery-rails' 26# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 27gem 'turbolinks', '~> 5' 28# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 29gem 'jbuilder', '~> 2.5' 30# Use Redis adapter to run Action Cable in production 31# gem 'redis', '~> 3.0' 32# Use ActiveModel has_secure_password 33# gem 'bcrypt', '~> 3.1.7' 34 35# Use Capistrano for deployment 36# gem 'capistrano-rails', group: :development 37 38group :development, :test do 39 # Call 'byebug' anywhere in the code to stop execution and get a debugger console 40 gem 'byebug', platform: :mri 41end 42 43group :development do 44 # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. 45 gem 'web-console', '>= 3.3.0' 46 gem 'listen', '~> 3.0.5' 47 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 48 gem 'spring' 49 gem 'spring-watcher-listen', '~> 2.0.0' 50end 51 52# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 53gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
退会済みユーザー👍を押しています

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

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

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

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

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

guest

回答1

0

ベストアンサー

エラー内にヒントがあります。

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

投稿2019/02/05 06:39

kazto

総合スコア7196

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

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

hazu

2019/02/05 06:45

yum install mysql-devel と入力すると以下のエラーが発生しました。 Loaded plugins: priorities, update-motd, upgrade-helper You need to be root to perform this command. 「rootになる必要がある」とはどう言うことですか?
kazto

2019/02/05 06:57

パッケージをインストールするには、`root`という管理者権限を持ったユーザになる必要があります。 rootをご存知無いということは、お使いのマシンはご自身でインストールしたものではない感じでしょうか。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問